Measurement: Avoid null shapes to be returned in all code branches (Fix #16820)

Returning a null shape would have triggered an exception in the bottom branch but not in the top one - which later leads to a segfault - solution - raise an exception. OOC doesn't like null shapes.
This commit is contained in:
Eric Price
2024-09-25 17:33:03 +02:00
committed by Chris Hennes
parent 9df2ec7b86
commit 69676a0f9d

View File

@@ -292,7 +292,11 @@ TopoDS_Shape Measurement::getShape(App::DocumentObject* rootObj, const char* sub
std::vector<std::string> names = Base::Tools::splitSubName(subName);
if (names.empty() || names.back() == "") {
return Part::Feature::getShape(rootObj);
TopoDS_Shape shape = Part::Feature::getShape(rootObj);
if (shape.IsNull()) {
throw Part::NullShapeException("null shape in measurement");
}
return shape;
}
try {