From 2cf06c0d6a96933b964d2b3078988ee268d2cf9b Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 6 Aug 2020 14:09:30 +0200 Subject: [PATCH] skip over nullptr from map() --- src/ifcgeom/schema_agnostic/IfcGeomIterator.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/schema_agnostic/IfcGeomIterator.h b/src/ifcgeom/schema_agnostic/IfcGeomIterator.h index dd112d7c32..3a6da1fd4b 100644 --- a/src/ifcgeom/schema_agnostic/IfcGeomIterator.h +++ b/src/ifcgeom/schema_agnostic/IfcGeomIterator.h @@ -234,9 +234,12 @@ namespace ifcopenshell { namespace geometry { std::transform(products.begin(), products.end(), std::back_inserter(items), [this, &placements](IfcUtil::IfcBaseClass* p) { auto item = converter_->mapping()->map(p); // Product placements do not affect item reuse and should temporarily be swapped to identity - std::swap(placements[item], ((taxonomy::geom_item*)item)->matrix); + if (item) { + std::swap(placements[item], ((taxonomy::geom_item*)item)->matrix); + } return item; }); + items.erase(std::remove(items.begin(), items.end(), nullptr), items.end()); std::sort(items.begin(), items.end(), taxonomy::less); auto it = items.begin(); while (it < items.end()) {