[Sketcher] Safeguard against spurious pre-selection

Preselection is sometimes not updated under some circumstances
1. when deleting an object through python;
2. before autoconstraint when deleting previous pole in bspline creation mode.

When the preselected curve is the deleted object, segfault/crash can happen.
This commit is contained in:
Ajinkya Dahale
2022-03-08 05:28:01 -05:00
committed by abdullahtahiriyo
parent 3fa1735088
commit f10ccfc0fb
2 changed files with 11 additions and 6 deletions

View File

@@ -303,7 +303,9 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade & geol
}
else if (preselectpoint != -1) {
preselectpointmfid = coinMapping.getIndexLayer(preselectpoint);
if (l == preselectpointmfid.layerId && preselectpointmfid.fieldIndex < PtNum)
if (MultiFieldId::Invalid != preselectpointmfid &&
preselectpointmfid.layerId == l &&
preselectpointmfid.fieldIndex < PtNum)
pcolor[preselectpointmfid.fieldIndex] = drawingParameters.PreselectColor;
}