diff --git a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp index d9057ae1c6..fa39b6b1fe 100644 --- a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp +++ b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp @@ -2226,14 +2226,16 @@ std::set EditModeConstraintCoinManager::detectPreselectionConstr(const SoPi float scaleFactor = translation->getScaleFactor(); // If this is the second icon in a pair, add its relative translation. - SoNode* secondIconNode = - sep->getChild(static_cast(ConstraintNodePosition::SecondIconIndex)); - if (tail == secondIconNode) { - auto translation2 = static_cast(sep->getChild( - static_cast(ConstraintNodePosition::SecondTranslationIndex))); - absPos += translation2->abPos.getValue(); - trans += translation2->translation.getValue(); - scaleFactor = translation2->getScaleFactor(); + if (int secondIndex = static_cast(ConstraintNodePosition::SecondIconIndex); + secondIndex < sep->getNumChildren()) { + SoNode* secondIconNode = sep->getChild(secondIndex); + if (tail == secondIconNode) { + auto translation2 = static_cast(sep->getChild( + static_cast(ConstraintNodePosition::SecondTranslationIndex))); + absPos += translation2->abPos.getValue(); + trans += translation2->translation.getValue(); + scaleFactor = translation2->getScaleFactor(); + } } // 3. Calculate the icon's center in world coordinates.