diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-04-06 16:10:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-06 16:10:09 +0100 |
| commit | f72e3f689be1d3cf1524e410b4cc6c676ecbca45 (patch) | |
| tree | e0059f1069a62a0da0553975e39614a998bf7c65 /src/check_stmt.cpp | |
| parent | cd6153a125c9c39bb8ab09a0e2ba62565284b04e (diff) | |
| parent | ca46484ae3ee548745992e6ad1435255e3ff604b (diff) | |
Merge pull request #3383 from oskarnp/or_return_crash
Fix checker crash when or_return used for non-existing proc
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index a543ed9b0..fc3b9aa43 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2075,13 +2075,13 @@ gb_internal void check_expr_stmt(CheckerContext *ctx, Ast *node) { } Ast *expr = strip_or_return_expr(operand.expr); - if (expr->kind == Ast_CallExpr) { + if (expr && expr->kind == Ast_CallExpr) { BuiltinProcId builtin_id = BuiltinProc_Invalid; bool do_require = false; AstCallExpr *ce = &expr->CallExpr; Type *t = base_type(type_of_expr(ce->proc)); - if (t->kind == Type_Proc) { + if (t && t->kind == Type_Proc) { do_require = t->Proc.require_results; } else if (check_stmt_internal_builtin_proc_id(ce->proc, &builtin_id)) { auto const &bp = builtin_procs[builtin_id]; @@ -2093,7 +2093,7 @@ gb_internal void check_expr_stmt(CheckerContext *ctx, Ast *node) { gb_string_free(expr_str); } return; - } else if (expr->kind == Ast_SelectorCallExpr) { + } else if (expr && expr->kind == Ast_SelectorCallExpr) { BuiltinProcId builtin_id = BuiltinProc_Invalid; bool do_require = false; |