diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-20 14:08:21 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-20 14:08:21 +0100 |
commit | 651a2650eb7d7471e0903b210a97ed1b15b6fe77 (patch) | |
tree | 5d9ac2f0c5ce4ac16f68b907b9e1cbf26b3f5fcd | |
parent | 44c5809b8c3af1be85d97673cc5a9585a65ef8f0 (diff) | |
download | stred-go-651a2650eb7d7471e0903b210a97ed1b15b6fe77.tar |
Fix bug that would crash if given an empty subex
-rw-r--r-- | subex/parse.go | 6 |
1 files changed, 5 insertions, 1 deletions
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 } |