fix crash when initializing struct if field is invalid

master
Andrew Kelley 2016-02-04 01:06:31 -07:00
parent bb4a532785
commit 3a9009b08e
1 changed files with 4 additions and 0 deletions

View File

@ -2121,6 +2121,10 @@ static TypeTableEntry *analyze_container_init_expr(CodeGen *g, ImportTableEntry
continue;
}
if (type_field->type_entry->id == TypeTableEntryIdInvalid) {
return g->builtin_types.entry_invalid;
}
int field_index = type_field->src_index;
field_use_counts[field_index] += 1;
if (field_use_counts[field_index] > 1) {