aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-04-08 12:06:06 +0100
committergingerBill <bill@gingerbill.org>2024-04-08 12:06:06 +0100
commit114ddc4a108eff7feb0cd83c7920998ddffd6dd1 (patch)
tree1aa071b7e60b07258be9cd57cc5120dee0bcc9c0 /src
parent0df9c8bffc3f468cab08eaad97b49952a0b6bf3e (diff)
Fix printing error when field name could not be found
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp3
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;