Skip to content

Commit 1154ce0

Browse files
committed
Properly handle empty/noop Writer#ldelim, fixes #625
1 parent f303049 commit 1154ce0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/writer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,12 @@ WriterPrototype.ldelim = function ldelim() {
519519
var head = this.head,
520520
tail = this.tail,
521521
len = this.len;
522-
this.reset()
523-
.uint32(len)
524-
.tail.next = head.next; // skip noop
525-
this.tail = tail;
526-
this.len += len;
522+
this.reset().uint32(len);
523+
if (len) {
524+
this.tail.next = head.next; // skip noop
525+
this.tail = tail;
526+
this.len += len;
527+
}
527528
return this;
528529
};
529530

0 commit comments

Comments
 (0)