summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--regex.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index 3943d93a..823f0c4e 100644
--- a/regex.c
+++ b/regex.c
@@ -1945,6 +1945,12 @@ static val reg_optimize(val exp)
if (arg1 == t || arg2 == t)
return t;
+ if (arg1 == nil)
+ return null(reg_nullable(arg2));
+
+ if (arg2 == nil)
+ return null(reg_nullable(arg1));
+
if (reg_matches_all(arg1))
return arg2;