diff --git a/src/writer.js b/src/writer.js index 17ff8089c..0a2c4205e 100644 --- a/src/writer.js +++ b/src/writer.js @@ -519,11 +519,12 @@ WriterPrototype.ldelim = function ldelim() { var head = this.head, tail = this.tail, len = this.len; - this.reset() - .uint32(len) - .tail.next = head.next; // skip noop - this.tail = tail; - this.len += len; + this.reset().uint32(len); + if (len) { + this.tail.next = head.next; // skip noop + this.tail = tail; + this.len += len; + } return this; };