Skip to content

Commit

Permalink
Properly handle empty/noop Writer#ldelim, fixes #625
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jan 7, 2017
1 parent f303049 commit 1154ce0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 1154ce0

Please sign in to comment.