Skip to content

Commit d810c3b

Browse files
Copilotbaelter
andauthored
Fix undefined field handling in AMQPView setField method (#148)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baelter <1399369+baelter@users.noreply.github.com>
1 parent 7212883 commit d810c3b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/amqp-view.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ export class AMQPView extends DataView<Uint8Array['buffer']> {
310310
}
311311
}
312312
break
313+
case "undefined":
314+
this.setUint8(i, 'V'.charCodeAt(0)); i += 1
315+
break
313316
case "object":
314317
if (Array.isArray(field)) {
315318
this.setUint8(i, 'A'.charCodeAt(0)); i += 1
@@ -324,7 +327,7 @@ export class AMQPView extends DataView<Uint8Array['buffer']> {
324327
this.setUint8(i, 'T'.charCodeAt(0)); i += 1
325328
const unixEpoch = Math.floor(Number(field) / 1000)
326329
this.setInt64(i, unixEpoch, littleEndian); i += 8
327-
} else if (field === null || field === undefined) {
330+
} else if (field === null) {
328331
this.setUint8(i, 'V'.charCodeAt(0)); i += 1
329332
} else { // hopefully it's a hash like object
330333
this.setUint8(i, 'F'.charCodeAt(0)); i += 1

0 commit comments

Comments
 (0)