From 1b5ef6e79ee0f80242a50506c9dac11ac5cd8d48 Mon Sep 17 00:00:00 2001 From: Joe Polny Date: Wed, 23 Oct 2024 17:04:42 -0400 Subject: [PATCH] fix: fixes error when mapping an ARC56 cblock PC on an empty/comment line (fixes #557) --- src/lib/compiler.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/compiler.ts b/src/lib/compiler.ts index 4ca911cf5..56dbd5c50 100644 --- a/src/lib/compiler.ts +++ b/src/lib/compiler.ts @@ -7623,13 +7623,8 @@ declare type AssetFreezeTxn = Required; if (sm.teal - 1 <= lastCblockLine) return; const pcs = this.lineToPc[sm.teal - 1]; - if (pcs === undefined) { - throw new Error( - `Internal Compiler Error: PC values not found when trying to calculate cblock offsets for TEAL line ${ - sm.teal - } (${this.teal[program][sm.teal - 1].teal}). Last cblock line was ${lastCblockLine}.` - ); - } + // PCs will be undefined if the line is blank or a comment + if (pcs === undefined) return; // eslint-disable-next-line no-param-reassign sm.pc = this.lineToPc[sm.teal - 1].map((pc) => pc - lastCblockPc);