[qfcc] Check init exists before checking compound

Fixes a segfault that occurred during a parse error in a def
initializer.
This commit is contained in:
Bill Currie 2021-09-24 19:44:14 +09:00
parent 6f71ef6657
commit 6144100d9b

View file

@ -559,7 +559,7 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space,
}
if (!sym->s.def) {
if (is_array (sym->type) && !type_size (sym->type)
&& init->type == ex_compound) {
&& init && init->type == ex_compound) {
sym->type = array_type (sym->type->t.array.type,
num_elements (init));
}