diff options
| author | gingerBill <bill@gingerbill.org> | 2024-04-12 14:51:22 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-04-12 14:51:22 +0100 |
| commit | 5726b7d9541d62f39cb5b04412f283a02e13c077 (patch) | |
| tree | aa21c6dcb35b40ee01876ed54886d0213f596242 /src/check_stmt.cpp | |
| parent | 4240e0025e1db18821148210e7c5260faef7d830 (diff) | |
Remove warning on clang
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index f2b7f8661..971841165 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -499,7 +499,7 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O ERROR_BLOCK(); error(lhs->expr, "Cannot assign to '%s'", str); - if (e) if (e->flags & EntityFlag_ForValue) { + if (e && e->flags & EntityFlag_ForValue) { isize offset = show_error_on_line(e->token.pos, token_pos_end(e->token), "Suggestion:"); if (offset < 0) { if (is_type_map(e->type)) { @@ -515,7 +515,7 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O error_line("'%.*s' is immutable, declare it as '&%.*s' to make it mutable\n", LIT(e->token.string), LIT(e->token.string)); } - } else if (e->flags & EntityFlag_SwitchValue) { + } else if (e && e->flags & EntityFlag_SwitchValue) { isize offset = show_error_on_line(e->token.pos, token_pos_end(e->token), "Suggestion:"); if (offset < 0) { error_line("\tSuggestion: Did you mean? 'switch &%.*s in ...'\n", LIT(e->token.string)); |