Skip to content

Commit

Permalink
Handle undefined in buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeblahblah committed Jan 18, 2024
1 parent ef2e6eb commit 3529b72
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ async function decode(buffer: Buffer): Promise<School> {
async function encode(school: School): Promise<Buffer> {
return new Promise((resolve, reject) => {
const outputBufferTransport = new TBufferedTransport(undefined, (buffer, seqId) => {
resolve(buffer);
if (buffer !== undefined) {
resolve(buffer);
} else {
reject();
}
});
const outputProtocol = new TCompactProtocol(outputBufferTransport);
SchoolSerde.write(outputProtocol, school);
Expand Down

0 comments on commit 3529b72

Please sign in to comment.