diff options
Diffstat (limited to 'src/environment.c')
| -rw-r--r-- | src/environment.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/environment.c b/src/environment.c index 603a04d9..ccbe4a8f 100644 --- a/src/environment.c +++ b/src/environment.c @@ -573,10 +573,10 @@ env_t *fresh_scope(env_t *env) { } env_t *with_enum_scope(env_t *env, type_t *t) { - while (t->tag == OptionalType) + while (t && t->tag == OptionalType) t = Match(t, OptionalType)->type; - if (t->tag != EnumType) return env; + if (t == NULL || t->tag != EnumType) return env; env = fresh_scope(env); env_t *ns_env = Match(t, EnumType)->env; for (tag_t *tag = Match(t, EnumType)->tags; tag; tag = tag->next) { |
