Core: GeoFeature::getPlacementFromProp prevent potential crash

This commit is contained in:
PaddleStroke
2025-09-19 14:32:56 +02:00
committed by Chris Hennes
parent ea08cb6776
commit 6e4d2a94d5

View File

@@ -301,6 +301,10 @@ std::vector<Data::IndexedName> GeoFeature::getHigherElements(const char* element
Base::Placement GeoFeature::getPlacementFromProp(App::DocumentObject* obj, const char* propName)
{
Base::Placement plc = Base::Placement();
if (!obj) {
return plc;
}
auto* propPlacement = dynamic_cast<App::PropertyPlacement*>(obj->getPropertyByName(propName));
if (propPlacement) {
plc = propPlacement->getValue();
@@ -381,3 +385,4 @@ Base::Placement GeoFeature::getGlobalPlacement(const DocumentObject* obj)
return placementProperty->getValue();
}