<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/parse.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-20 14:08:21 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-20 14:08:21 +0100
commit651a2650eb7d7471e0903b210a97ed1b15b6fe77 (patch)
tree5d9ac2f0c5ce4ac16f68b907b9e1cbf26b3f5fcd /subex/parse.go
parent44c5809b8c3af1be85d97673cc5a9585a65ef8f0 (diff)
downloadstred-go-651a2650eb7d7471e0903b210a97ed1b15b6fe77.tar
Fix bug that would crash if given an empty subex
Diffstat (limited to 'subex/parse.go')
-rw-r--r--subex/parse.go6
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
}