mirror of
https://github.com/alecthomas/chroma.git
synced 2025-11-25 22:32:32 +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:
@@ -630,7 +630,9 @@ func haxePreProcMutator(state *LexerState) error {
|
|||||||
state.Stack = stack[len(stack)-1]
|
state.Stack = stack[len(stack)-1]
|
||||||
}
|
}
|
||||||
case "end":
|
case "end":
|
||||||
stack = stack[:len(stack)-1]
|
if len(stack) > 0 {
|
||||||
|
stack = stack[:len(stack)-1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if proc == "if" || proc == "elseif" {
|
if proc == "if" || proc == "elseif" {
|
||||||
|
|||||||
Reference in New Issue
Block a user