X3D: simplistic attempt to avoid crashes due to nullptr access

Related: https://github.com/assimp/assimp/issues/4201

while the crashes go away, i'm not sure whether this is the correct fix.
also, afaict the X3D importer produces wrong results anyhow
pull/4217/head
IOhannes m zmölnig 2021-12-01 12:21:29 +01:00
parent c8cdf3009e
commit 0e2ac2a91c
1 changed files with 6 additions and 1 deletions

View File

@ -226,8 +226,13 @@ void X3DImporter::startReadTransform(XmlNode &node) {
// if "USE" defined then find already defined element. // if "USE" defined then find already defined element.
if (!use.empty()) { if (!use.empty()) {
X3DNodeElementBase *ne(nullptr); X3DNodeElementBase *ne(nullptr);
bool newgroup = (nullptr == mNodeElementCur);
if(newgroup)
ParseHelper_Group_Begin();
ne = MACRO_USE_CHECKANDAPPLY(node, def, use, ENET_Group, ne); ne = MACRO_USE_CHECKANDAPPLY(node, def, use, ENET_Group, ne);
if (newgroup && isNodeEmpty(node)) {
ParseHelper_Node_Exit();
}
} else { } else {
ParseHelper_Group_Begin(); // create new grouping element and go deeper if node has children. ParseHelper_Group_Begin(); // create new grouping element and go deeper if node has children.
// at this place new group mode created and made current, so we can name it. // at this place new group mode created and made current, so we can name it.