diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index a6fb431b9a..58953462d2 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3379,6 +3379,7 @@ void ViewProviderSketch::drawConstraintIcons() // Find the Constraint Icon SoImage Node SoSeparator *sep = static_cast(edit->constrGroup->getChild(constrId)); + int numChildren = sep->getNumChildren(); SbVec3f absPos; // Somewhat hacky - we use SoZoomTranslations for most types of icon, @@ -3442,14 +3443,16 @@ void ViewProviderSketch::drawConstraintIcons() // So, to get the position of the second icon, we add the two translations together // // See note ~30 lines up. - translationPtr = static_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_SECOND_TRANSLATION)); - if(dynamic_cast(translationPtr)) - thisIcon.position += static_cast(translationPtr)->abPos.getValue(); - else - thisIcon.position += translationPtr->translation.getValue(); + if (numChildren > CONSTRAINT_SEPARATOR_INDEX_SECOND_CONSTRAINTID) { + translationPtr = static_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_SECOND_TRANSLATION)); + if(dynamic_cast(translationPtr)) + thisIcon.position += static_cast(translationPtr)->abPos.getValue(); + else + thisIcon.position += translationPtr->translation.getValue(); - thisIcon.destination = dynamic_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_SECOND_ICON)); - thisIcon.infoPtr = static_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_SECOND_CONSTRAINTID)); + thisIcon.destination = dynamic_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_SECOND_ICON)); + thisIcon.infoPtr = static_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_SECOND_CONSTRAINTID)); + } } else { if ((*it)->Name.empty())