Skip to content

Commit 17a433a

Browse files
committed
Don't pass around nullptr in case of failed representation mapping
1 parent b90c1ee commit 17a433a

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/ifcgeom/Converter.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,13 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_process
363363
}
364364

365365
IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_representation_and_product(const IfcUtil::IfcBaseEntity* representation, const IfcUtil::IfcBaseEntity* product) {
366+
auto interpreted_representation = mapping_->map(representation);
367+
if (!interpreted_representation) {
368+
interpreted_representation = taxonomy::make<taxonomy::collection>();
369+
interpreted_representation->instance = representation;
370+
}
366371
return create_brep_for_representation_and_product(
367-
mapping_->map(representation),
372+
interpreted_representation,
368373
product,
369374
taxonomy::cast<taxonomy::geom_item>(mapping_->map(product))->matrix
370375
);

src/ifcwrap/IfcGeomWrapper.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
724724

725725
typename Schema::IfcProductRepresentation* prodrep = product->Representation();
726726
typename Schema::IfcRepresentation::list::ptr reps = prodrep->Representations();
727-
typename Schema::IfcRepresentation* ifc_representation = (typename Schema::IfcRepresentation*) representation;
727+
typename Schema::IfcRepresentation* ifc_representation = representation->as<typename Schema::IfcRepresentation>();
728728

729729
if (!ifc_representation) {
730730
// First, try to find a representation based on the settings

0 commit comments

Comments
 (0)