mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
cppparser: Fix crash redefining struct as typedef
This would crash on the following code: struct aaa; typedef struct {} aaa;
This commit is contained in:
parent
014fd97fef
commit
78f1a5b15a
@ -211,7 +211,7 @@ is_equivalent(const CPPType &other) const {
|
|||||||
// We consider two different extension types to be equivalent if they have
|
// We consider two different extension types to be equivalent if they have
|
||||||
// the same name.
|
// the same name.
|
||||||
|
|
||||||
return *_ident == *ot->_ident;
|
return _ident != nullptr && ot->_ident != nullptr && *_ident == *ot->_ident;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,8 +164,10 @@ define_typedef_type(CPPTypedefType *type, CPPPreprocessor *error_sink) {
|
|||||||
errstr << " has conflicting declaration as ";
|
errstr << " has conflicting declaration as ";
|
||||||
other_type->output(errstr, 0, nullptr, true);
|
other_type->output(errstr, 0, nullptr, true);
|
||||||
error_sink->error(errstr.str(), type->_ident->_loc);
|
error_sink->error(errstr.str(), type->_ident->_loc);
|
||||||
error_sink->error("previous definition is here",
|
if (other_td != nullptr && other_td->_ident != nullptr) {
|
||||||
other_td->_ident->_loc);
|
error_sink->error("previous definition is here",
|
||||||
|
other_td->_ident->_loc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user