diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-02-04 01:06:31 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-02-04 01:06:31 -0700 |
| commit | 3a9009b08e278dafd7b59b7d09408c80ea67f1fe (patch) | |
| tree | 278cc2058a73cdf18c186163cc9a846633e5550e /src | |
| parent | bb4a532785e8bcd0080eeac291bd3b205279f045 (diff) | |
| download | zig-3a9009b08e278dafd7b59b7d09408c80ea67f1fe.tar.gz zig-3a9009b08e278dafd7b59b7d09408c80ea67f1fe.zip | |
fix crash when initializing struct if field is invalid
Diffstat (limited to 'src')
| -rw-r--r-- | src/analyze.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index e2b76a4a8c..c0fc33ba08 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -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) { |
