diff options
| author | gingerBill <bill@gingerbill.org> | 2023-07-07 23:09:46 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-07-07 23:09:46 +0100 |
| commit | 6495f2cf989351470b92e6cab3881c7cb85a6a5c (patch) | |
| tree | 33af2f656dab7c2a6da4d9387052b8ce743191a5 /src/check_expr.cpp | |
| parent | ea20b644cc82401c3e6e76c55cb8aac7ed655e56 (diff) | |
Fix #2593
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 4e39b83bd..b662c231f 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4774,7 +4774,10 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod if (entity == nullptr && selector->kind == Ast_Ident) { String field_name = selector->Ident.token.string; - if (is_type_dynamic_array(type_deref(operand->type))) { + Type *t = type_deref(operand->type); + if (t == nullptr) { + error(operand->expr, "Cannot use a selector expression on 0-value expression"); + } else if (is_type_dynamic_array(t)) { init_mem_allocator(c->checker); } sel = lookup_field(operand->type, field_name, operand->mode == Addressing_Type); |