From 6fb05fa7434431d710f28f529f10af588daf8f48 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 10 Jun 2024 21:40:39 +0200 Subject: [PATCH] Fix segfault on grid placement. Don't fail on nullptr transformation. #4832 --- src/ifcgeom/IfcGeomElement.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcGeomElement.h b/src/ifcgeom/IfcGeomElement.h index 14c321f620..698966d2d7 100644 --- a/src/ifcgeom/IfcGeomElement.h +++ b/src/ifcgeom/IfcGeomElement.h @@ -42,7 +42,13 @@ namespace IfcGeom { : settings_(settings) , matrix_(matrix) {} - const ifcopenshell::geometry::taxonomy::matrix4::ptr& data() const { return matrix_; } + const ifcopenshell::geometry::taxonomy::matrix4::ptr& data() const { + if (matrix_) { + return matrix_; + } + static ifcopenshell::geometry::taxonomy::matrix4::ptr iden = ifcopenshell::geometry::taxonomy::make(); + return iden; + } }; class Element {