From 10ea9d700ee1de8759e81c4e15571fb962d23fa7 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 20 Nov 2018 12:10:44 +0100 Subject: [PATCH] Check for null pointers returned by find_representation() --- src/ifcgeom/IfcGeomFunctions.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index f77d8e0e19..4925db3a0d 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -1818,9 +1818,15 @@ bool IfcGeom::Kernel::convert_layerset(const IfcSchema::IfcProduct* product, std } IfcSchema::IfcRepresentation* body_representation = find_representation(product, "Body"); - IfcSchema::IfcRepresentation* axis_representation = find_representation(product, "Axis"); + + if (!body_representation) { + Logger::Warning("No body representation for product", product->entity); + return false; + } if (product->is(IfcSchema::Type::IfcWall)) { + IfcSchema::IfcRepresentation* axis_representation = find_representation(product, "Axis"); + if (!axis_representation) { Logger::Message(Logger::LOG_WARNING, "No axis representation for:", product->entity); return false; @@ -2190,10 +2196,16 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre gp_Trsf other; if (!convert(other_wall->ObjectPlacement(), other)) { + Logger::Error("Failed to convert placement", other_wall->entity); continue; } IfcSchema::IfcRepresentation* axis_representation = find_representation(other_wall, "Axis"); + + if (!axis_representation) { + Logger::Warning("Joined wall has no axis representation", other_wall->entity); + continue; + } IfcRepresentationShapeItems axis_items; {