commit 651a2650eb7d7471e0903b210a97ed1b15b6fe77 parent 44c5809b8c3af1be85d97673cc5a9585a65ef8f0 Author: Charlie Stanton <charlie@shtanton.xyz> Date: Thu, 20 Apr 2023 14:08:21 +0100 Fix bug that would crash if given an empty subex Diffstat:
M | subex/parse.go | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/subex/parse.go b/subex/parse.go @@ -356,5 +356,9 @@ func parseSubex(l RuneReader, minPower int) SubexAST { } func Parse(l RuneReader) SubexAST { - return parseSubex(l, 0) + ast := parseSubex(l, 0) + if ast == nil { + return SubexASTEmpty{} + } + return ast }