diff options
| author | gingerBill <bill@gingerbill.org> | 2024-04-08 12:06:06 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-04-08 12:06:06 +0100 |
| commit | 114ddc4a108eff7feb0cd83c7920998ddffd6dd1 (patch) | |
| tree | 1aa071b7e60b07258be9cd57cc5120dee0bcc9c0 /src/check_expr.cpp | |
| parent | 0df9c8bffc3f468cab08eaad97b49952a0b6bf3e (diff) | |
Fix printing error when field name could not be found
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index c80b08695..fe8c9599f 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4595,7 +4595,8 @@ gb_internal ExactValue get_constant_field_single(CheckerContext *c, ExactValue v String name = fv->field->Ident.token.string; Selection sub_sel = lookup_field(node->tav.type, name, false); defer (array_free(&sub_sel.index)); - if (sub_sel.index[0] == index) { + if (sub_sel.index.count > 0 && + sub_sel.index[0] == index) { value = fv->value->tav.value; found = true; break; |