Skip to content

Commit

Permalink
Fix - correctly handle empty std::map
Browse files Browse the repository at this point in the history
Seems to be, no extra information written into the buffer
when map is empty
  • Loading branch information
linev committed Aug 2, 2024
1 parent bad7680 commit 64f4bb7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/io.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3549,6 +3549,11 @@ function readMapElement(buf) {
}

const n = buf.ntoi4(), res = new Array(n);

// no extra data written for empty map
if (n === 0)
return res;

if (this.member_wise && (buf.remain() >= 6)) {
if (buf.ntoi2() === kStreamedMemberWise)
buf.shift(4); // skip checksum
Expand Down

0 comments on commit 64f4bb7

Please sign in to comment.