aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorFeoramund <161657516+Feoramund@users.noreply.github.com>2024-07-14 14:59:00 -0400
committerFeoramund <161657516+Feoramund@users.noreply.github.com>2024-07-14 14:59:00 -0400
commitb38237e8f0872fd8979a729553338e01d04dc3e8 (patch)
treec7ff45bf164ad74c41b7d582dbc10f3858c4fd0c /src/check_stmt.cpp
parente7d37607ef9ce54a80d83230150874b71d628d6d (diff)
Fix compiler crash when switching on no value
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index f4d3bd6b8..74397828d 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1060,6 +1060,9 @@ gb_internal void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags
if (ss->tag != nullptr) {
check_expr(ctx, &x, ss->tag);
check_assignment(ctx, &x, nullptr, str_lit("switch expression"));
+ if (x.type == nullptr) {
+ return;
+ }
} else {
x.mode = Addressing_Constant;
x.type = t_bool;