From faa13a938d78d1433bd3115aea4a757f0ea40dae Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 26 Dec 2024 14:03:27 +0100 Subject: [PATCH] Preliminary file existance check before attempting mapping --- src/ifcwrap/IfcGeomWrapper.i | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index 05442d59c3..8d52625e6e 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -1021,6 +1021,9 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type %inline %{ ifcopenshell::geometry::taxonomy::item::ptr map_shape(ifcopenshell::geometry::Settings& settings, IfcUtil::IfcBaseClass* instance) { + if (instance->file_ == nullptr) { + throw std::runtime_error("Unable to map instance without file"); + } std::unique_ptr mapping(ifcopenshell::geometry::impl::mapping_implementations().construct(instance->file_, settings)); return mapping->map(instance); }