Gui: Fix segfault in align to selection tool

This commit is contained in:
Bas Ruigrok
2024-09-19 20:31:36 +02:00
committed by Chris Hennes
parent 94567e995b
commit 331c7ad59d

View File

@@ -3380,7 +3380,8 @@ void View3DInventorViewer::alignToSelection()
const auto globalPlacement = App::GeoFeature::getGlobalPlacement(selection[0].pResolvedObject, selection[0].pObject, elementName.oldName);
const auto rotation = globalPlacement.getRotation() * geoFeature->Placement.getValue().getRotation().inverse();
const auto geoFeatureSubName = Base::Tools::splitSubName(elementName.oldName).back();
const auto splitSubName = Base::Tools::splitSubName(elementName.oldName);
const auto geoFeatureSubName = !splitSubName.empty() ? splitSubName.back() : "";
Base::Vector3d direction;
if (geoFeature->getCameraAlignmentDirection(direction, geoFeatureSubName.c_str())) {