1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-11-23 22:24:39 +02:00

Prevent panic from hax lexer (#812)

Prevents `runtime error: slice bounds out of range` when list is empty.
This commit is contained in:
Alan Hamlett
2023-08-15 23:50:03 +02:00
committed by GitHub
parent 2aad7403e6
commit 68d976f00b

View File

@@ -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" {