Skip to content

Commit

Permalink
Prevent panic from hax lexer (#812)
Browse files Browse the repository at this point in the history
Prevents `runtime error: slice bounds out of range` when list is empty.
  • Loading branch information
alanhamlett committed Aug 15, 2023
1 parent 2aad740 commit 68d976f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lexers/haxe.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,9 @@ func haxePreProcMutator(state *LexerState) error {
state.Stack = stack[len(stack)-1]
}
case "end":
stack = stack[:len(stack)-1]
if len(stack) > 0 {
stack = stack[:len(stack)-1]
}
}

if proc == "if" || proc == "elseif" {
Expand Down

0 comments on commit 68d976f

Please sign in to comment.