Preliminary file existance check before attempting mapping

This commit is contained in:
Thomas Krijnen
2024-12-26 14:03:27 +01:00
parent 457f441187
commit faa13a938d
+3
View File
@@ -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<ifcopenshell::geometry::abstract_mapping> mapping(ifcopenshell::geometry::impl::mapping_implementations().construct(instance->file_, settings));
return mapping->map(instance);
}