Sketcher: fix segfault on distance constraints without SecondPos

This commit is contained in:
bdieterm
2023-08-29 22:28:49 +02:00
committed by Chris Hennes
parent 0445b88d55
commit 7013ce0cbc

View File

@@ -826,12 +826,13 @@ Restart:
case DistanceY: {
assert(Constr->First >= -extGeoCount && Constr->First < intGeoCount);
Base::Vector3d pnt1(0., 0., 0.), pnt2(0., 0., 0.);
const Part::Geometry* geo = geolistfacade.getGeometryFromGeoId(Constr->Second);
if (Constr->SecondPos != Sketcher::PointPos::none) {// point to point distance
pnt1 = geolistfacade.getPoint(Constr->First, Constr->FirstPos);
pnt2 = geolistfacade.getPoint(Constr->Second, Constr->SecondPos);
}
else if (Constr->Second != GeoEnum::GeoUndef) {
const Part::Geometry* geo =
geolistfacade.getGeometryFromGeoId(Constr->Second);
if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
const Part::GeomLineSegment* lineSeg =
static_cast<const Part::GeomLineSegment*>(geo);