From 908d85a51a60bd2d5a25b87056de26b51527f3fa Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 21 Aug 2026 17:51:45 +0500 Subject: [PATCH] IfcAdvancedHouse: report an error in case serialization fails Instead of a crash --- src/examples/IfcAdvancedHouse.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/examples/IfcAdvancedHouse.cpp b/src/examples/IfcAdvancedHouse.cpp index 2eef11fb4e..04fe951d54 100644 --- a/src/examples/IfcAdvancedHouse.cpp +++ b/src/examples/IfcAdvancedHouse.cpp @@ -101,7 +101,12 @@ int main() { // IfcFacetedBRep. If it would not be a polyhedron, serialise() can only be successful when linked // to the IFC4 model and with `advanced` set to `true` which introduces IfcAdvancedFace. It would // return `0` otherwise. - auto building_shape = ifcopenshell::geom::serialise(file, building_shell, false).as(); + auto building_shape_result = ifcopenshell::geom::serialise(file, building_shell, false); + if (!building_shape_result) { + std::cerr << "Failed to serialize building shell." << std::endl; + return 1; + } + auto building_shape = building_shape_result.as(); file.add_entity(building_shape); auto building_representations = building_shape.Representations();