From 331c7ad59dcd2ea84af59e30988062ff4641bd1f Mon Sep 17 00:00:00 2001 From: Bas Ruigrok Date: Thu, 19 Sep 2024 20:31:36 +0200 Subject: [PATCH] Gui: Fix segfault in align to selection tool --- src/Gui/View3DInventorViewer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 5e8c5412c2..defc635fcf 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -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())) {