Handle invalid struct members
When something goes wrong when parsing a struct member, e.g. the type does
not exist, a nullptr is added to the struct member list. This will cause a
crash when iterating over the list.
E.g.
```
struct packed {
logc x;
} s;
```
Add a check so that nullptr members are not added to the list.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
8b1240f7cf
commit
5bfc8a42eb
4
parse.y
4
parse.y
|
|
@ -3036,12 +3036,12 @@ struct_data_type
|
|||
struct_union_member_list
|
||||
: struct_union_member_list struct_union_member
|
||||
{ std::list<struct_member_t*>*tmp = $1;
|
||||
tmp->push_back($2);
|
||||
if ($2) tmp->push_back($2);
|
||||
$$ = tmp;
|
||||
}
|
||||
| struct_union_member
|
||||
{ std::list<struct_member_t*>*tmp = new std::list<struct_member_t*>;
|
||||
tmp->push_back($1);
|
||||
if ($1) tmp->push_back($1);
|
||||
$$ = tmp;
|
||||
}
|
||||
;
|
||||
|
|
|
|||
Loading…
Reference in New Issue