From ab11ac53387b4e15ccd5212576ac5e99b6c7f6b0 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 9 Jun 2026 21:35:40 +0200 Subject: [PATCH] Catch decomposition errors #8149 --- src/ifcgeom/mapping/mapping.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index a44ef1a57a..fe6ebab56a 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -198,8 +198,14 @@ aggregate_of_instance::ptr mapping::find_openings(const IfcUtil::IfcBaseEntity* // Only aggregation, not nesting is considered. break; } - IfcSchema::IfcObjectDefinition* rel_obdef = (*decomposes->begin())->as()->RelatingObject(); - if (rel_obdef->as() && !rel_obdef->as()) { + IfcSchema::IfcObjectDefinition* rel_obdef = nullptr; + try { + rel_obdef = (*decomposes->begin())->as()->RelatingObject(); + } catch (const std::exception&) { + // exception already logged as part of handling of placement + break; + } + if (rel_obdef && rel_obdef->as() && !rel_obdef->as()) { IfcSchema::IfcElement* element = rel_obdef->as(); auto rels = element->HasOpenings(); for (auto& rel : *rels) {