Skip to content

Commit

Permalink
fix bug: off-by-1 reported offset on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
christo committed Dec 19, 2024
1 parent 96e6190 commit 8938396
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/machine/asm/Disassembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,11 @@ class Disassembler {
* @private
*/
private eatByte(): number {
const value = this.fb.read8(this.currentIndex++); // side effect
const value = this.fb.read8(this.currentIndex); // side effect
if (typeof value === "undefined") {
throw Error(`Illegal state, no byte at index ${this.currentIndex}`);
} else {
this.currentIndex++;
return (value & 0xff);
}
}
Expand Down

0 comments on commit 8938396

Please sign in to comment.