Sketcher: prevent undo/redo crash when selected geometry goes away.

Fixes #25497
This commit is contained in:
pjcreath
2025-11-20 15:04:08 -05:00
committed by Chris Hennes
parent 16aff10544
commit efb10e1b28
2 changed files with 4 additions and 1 deletions

View File

@@ -359,6 +359,9 @@ bool isCommandNeedingBSplineKnotActive(Gui::Document* doc)
}
auto* Obj = static_cast<Sketcher::SketchObject*>(sel[0].getObject());
if (!Obj) {
return false;
}
const std::string& name = names[0];
int geoId {GeoEnum::GeoUndef};

View File

@@ -355,7 +355,7 @@ bool SketcherGui::isBsplineKnotOrEndPoint(
const Part::Geometry* geo = Obj->getGeometry(GeoId);
// end points of B-Splines are also knots
if (geo->is<Part::GeomBSplineCurve>()
if (geo && geo->is<Part::GeomBSplineCurve>()
&& (PosId == Sketcher::PointPos::start || PosId == Sketcher::PointPos::end)) {
return true;
}