diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index 46d1848265..6cefc9ae42 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -400,8 +400,10 @@ void SoFCUnifiedSelection::doAction(SoAction *action) auto subName = selaction->SelChange.pSubName; #ifdef FC_USE_TNP_FIX std::pair elementName; - App::GeoFeature::resolveElement(obj,subName,elementName); - subName = elementName.second.c_str(); // Use the shortened element name not the full one. + App::GeoFeature::resolveElement(obj, subName, elementName); + if (!elementName.second.empty()) { // If we have a shortened element name + subName = elementName.second.c_str(); // use it. + } #endif if(!selaction->SelChange.pSubName || !selaction->SelChange.pSubName[0] || vp->getDetailPath(subName,detailPath,true,detail)) diff --git a/src/Gui/View3DInventorSelection.cpp b/src/Gui/View3DInventorSelection.cpp index a9d0cf6dba..52a81206a7 100644 --- a/src/Gui/View3DInventorSelection.cpp +++ b/src/Gui/View3DInventorSelection.cpp @@ -116,8 +116,10 @@ void View3DInventorSelection::checkGroupOnTop(const SelectionChanges &Reason) auto subname = Reason.pSubName; #ifdef FC_USE_TNP_FIX std::pair element; - App::GeoFeature::resolveElement(obj,Reason.pSubName,element); - subname = element.second.c_str(); + App::GeoFeature::resolveElement(obj, Reason.pSubName, element); + if (!element.second.empty()) { // If we have a shortened element name + subname = element.second.c_str(); // use if + } #endif if(subname) key += subname;