From dc75130da36fd3387809e8048159b546941046f3 Mon Sep 17 00:00:00 2001 From: Henning Berge Date: Tue, 18 May 2021 21:16:58 +0200 Subject: [PATCH] Fix an error in the binary reader if the return of string.unpack is just a number it flips its shit --- system/binaryreader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/binaryreader.ts b/system/binaryreader.ts index a060dfc..05df620 100644 --- a/system/binaryreader.ts +++ b/system/binaryreader.ts @@ -38,7 +38,7 @@ export class BinaryReader { public read(fmt: string, size: number) { const unpacked = string.unpack(fmt, this.data, this.pos); this.pos += size; - if (unpacked.length <= 0) { + if (typeof unpacked === 'number' || unpacked.length <= 0) { return 0; } return unpacked[0];