Skip to content

Commit

Permalink
Monkey-patch pointer=0
Browse files Browse the repository at this point in the history
  • Loading branch information
t4t5 committed Dec 22, 2024
1 parent 6f0eda7 commit fe771fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ const TagCoder: P.Coder<TagRaw[], Tags> = {
for (const p of to.parent) res.push({ tag: tagName, data: TagCoders.parent.encode(p) });
continue;
}
const bytes = TagCoders[field as TagName].encode(to[field as TagName]);
let bytes = TagCoders[field as TagName].encode(to[field as TagName]);

// Handle pointer = 0:
if (field === 'pointer' && bytes.length === 0) {
bytes = new Uint8Array([0]);
}

for (const data of splitChunks(bytes)) res.push({ tag: tagName, data });
}
if (to.unknown) {
Expand Down

0 comments on commit fe771fa

Please sign in to comment.