diff --git a/src/ifcgeom/schema/mapping.cpp b/src/ifcgeom/schema/mapping.cpp index d59273fd91..549baeaf82 100644 --- a/src/ifcgeom/schema/mapping.cpp +++ b/src/ifcgeom/schema/mapping.cpp @@ -348,7 +348,13 @@ taxonomy::item* mapping::map_impl(const IfcSchema::IfcProduct* inst) { n->instance = inst; c->children = { n }; } else { - c->children = { map(body) }; + auto child = map(body); + if (child) { + c->children = { child }; + } else { + delete c; + return nullptr; + } } return c; }