Fix crash for union type formatting with unknown member (#3389)

This commit is contained in:
Anton Kochkov 2023-02-21 17:03:19 +08:00 committed by GitHub
parent c1edf60d3c
commit 51e5868575
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2884,7 +2884,7 @@ static void base_type_to_format_unfold(const RzTypeDB *typedb, RZ_NONNULL RzBase
rz_vector_foreach(&type->union_data.members, memb) {
const char *membtype = type_to_identifier(typedb, memb->type);
// Avoid infinite recursion in case of self-referential unions
if (!strcmp(membtype, type->name)) {
if (!membtype || !strcmp(membtype, type->name)) {
continue;
}
if (rz_type_is_identifier(memb->type)) {