Skip to content

Commit

Permalink
Corrigir crash constante do error listener
Browse files Browse the repository at this point in the history
  • Loading branch information
dgadelha committed Oct 8, 2023
1 parent dbe4843 commit 8562ef2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/antlr/src/PortugolErrorListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export class PortugolCodeError extends Error {
possibleContext = ctx.parent;
}

if (possibleContext.hasOwnProperty("_start") && possibleContext.hasOwnProperty("_stop")) {
if (
possibleContext.hasOwnProperty("_start") &&
possibleContext.hasOwnProperty("_stop") &&
typeof (possibleContext as unknown as { _start: any })._start === "object" &&
typeof (possibleContext as unknown as { _stop: any })._stop === "object"
) {
const { _start, _stop } = possibleContext as unknown as { _start: any; _stop: any };

return new PortugolCodeError(
Expand Down

0 comments on commit 8562ef2

Please sign in to comment.