From 79a369af8b56d9e77d848b5aa6109880c4e5a950 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Tue, 15 Aug 2023 16:46:18 +0200 Subject: [PATCH] Prevent panic from hax lexer Prevents `runtime error: slice bounds out of range` when list is empty. --- lexers/haxe.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lexers/haxe.go b/lexers/haxe.go index 6e23938da..9a72de865 100644 --- a/lexers/haxe.go +++ b/lexers/haxe.go @@ -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" {