Sketcher: fix crash when trying to edit malformed sketch

For more details see: https://forum.freecad.org/viewtopic.php?p=745031#p745031
This commit is contained in:
wmayer
2024-03-05 10:19:07 +01:00
committed by Chris Hennes
parent 262a858be5
commit 62dee011ef

View File

@@ -1749,9 +1749,11 @@ void EditModeConstraintCoinManager::updateConstraintColor(
SoMaterial* m = nullptr;
if (!hasDatumLabel && type != Sketcher::Coincident && type != Sketcher::InternalAlignment) {
hasMaterial = true;
m = static_cast<SoMaterial*>(
s->getChild(static_cast<int>(ConstraintNodePosition::MaterialIndex)));
int matIndex = static_cast<int>(ConstraintNodePosition::MaterialIndex);
if (matIndex < s->getNumChildren()) {
hasMaterial = true;
m = static_cast<SoMaterial*>(s->getChild(matIndex));
}
}
auto selectpoint = [this, pcolor, PtNum](int geoid, Sketcher::PointPos pos) {