Part: Fix segmentation fault in Feature::getExportElementName

Calling ShapeType() on a null shape is not allowed and causes a segmentation fault. So, check beforehand if the shape is not null.

Fixes #18537
This commit is contained in:
wmayer
2024-12-16 14:58:35 +01:00
committed by Chris Hennes
parent a88f30877c
commit bbb5b45133

View File

@@ -365,7 +365,7 @@ App::ElementNamePair Feature::getExportElementName(TopoShape shape,
// find it by matching either planes for faces or lines for edges.
auto searchShape = this->Shape.getShape();
// If we're still out at a Shell, Solid, CompSolid, or Compound drill in
while (searchShape.getShape().ShapeType() < TopAbs_FACE ) {
while (!searchShape.getShape().IsNull() && searchShape.getShape().ShapeType() < TopAbs_FACE ) {
auto shapes = searchShape.getSubTopoShapes();
if ( shapes.empty() ) // No more subshapes, so don't continue
break;