diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index af4e039536..46fcc459e6 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -1530,8 +1530,8 @@ IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and int parent_id = -1; try { - IfcSchema::IfcObjectDefinition* parent_object = get_decomposing_entity(product)->as(); - if (parent_object) { + IfcUtil::IfcBaseEntity* parent_object = get_decomposing_entity(product); + if (parent_object && parent_object->as()) { parent_id = parent_object->data().id(); } } catch (const std::exception& e) { @@ -1777,8 +1777,8 @@ IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_represen { int parent_id = -1; try { - IfcSchema::IfcObjectDefinition* parent_object = get_decomposing_entity(product)->as(); - if (parent_object) { + IfcUtil::IfcBaseEntity* parent_object = get_decomposing_entity(product); + if (parent_object && parent_object->as()) { parent_id = parent_object->data().id(); } } catch (const std::exception& e) {