Skip to content

Commit

Permalink
Merge pull request #560 from algorandfoundation/fix/undefined_pcs_bug
Browse files Browse the repository at this point in the history
fix: fixes error when mapping an ARC56 cblock PC on an empty/comment line (fixes #557)
  • Loading branch information
joe-p authored Oct 23, 2024
2 parents 0a3eb25 + 1b5ef6e commit cb89bb9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7623,13 +7623,8 @@ declare type AssetFreezeTxn = Required<AssetFreezeParams>;
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);
Expand Down

0 comments on commit cb89bb9

Please sign in to comment.