From 651a2650eb7d7471e0903b210a97ed1b15b6fe77 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Thu, 20 Apr 2023 14:08:21 +0100 Subject: Fix bug that would crash if given an empty subex --- subex/parse.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'subex') diff --git a/subex/parse.go b/subex/parse.go index 1e5e36e..24ff3d1 100644 --- 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 } -- cgit v1.2.3