From 839ca49a7a1ee096dea5b83c4e2c2212704509e5 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 20 May 2020 11:55:59 +0200 Subject: [PATCH] Fix #861 --- src/ifcgeom/IfcGeomFunctions.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index b2a75f0083..8043921d8e 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -1925,20 +1925,25 @@ IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and IfcSchema::IfcRepresentation* IfcGeom::Kernel::representation_mapped_to(const IfcSchema::IfcRepresentation* representation) { IfcSchema::IfcRepresentation* representation_mapped_to = 0; - IfcSchema::IfcRepresentationItem::list::ptr items = representation->Items(); - if (items->size() == 1) { - IfcSchema::IfcRepresentationItem* item = *items->begin(); - if (item->declaration().is(IfcSchema::IfcMappedItem::Class())) { - if (item->StyledByItem()->size() == 0) { - IfcSchema::IfcMappedItem* mapped_item = item->as(); - if (is_identity_transform(mapped_item->MappingTarget())) { - IfcSchema::IfcRepresentationMap* map = mapped_item->MappingSource(); - if (is_identity_transform(map->MappingOrigin())) { - representation_mapped_to = map->MappedRepresentation(); + try { + IfcSchema::IfcRepresentationItem::list::ptr items = representation->Items(); + if (items->size() == 1) { + IfcSchema::IfcRepresentationItem* item = *items->begin(); + if (item->declaration().is(IfcSchema::IfcMappedItem::Class())) { + if (item->StyledByItem()->size() == 0) { + IfcSchema::IfcMappedItem* mapped_item = item->as(); + if (is_identity_transform(mapped_item->MappingTarget())) { + IfcSchema::IfcRepresentationMap* map = mapped_item->MappingSource(); + if (is_identity_transform(map->MappingOrigin())) { + representation_mapped_to = map->MappedRepresentation(); + } } } } } + } catch (const IfcParse::IfcException& e) { + Logger::Error(e); + // @todo reset representation_mapped_to to zero? } return representation_mapped_to; }