From 985f3510f5f53d59914ce1efe2ad40288f401723 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 18 Dec 2020 17:50:49 +0100 Subject: [PATCH] Sketcher: Fix crash when creating an angle constrain on a line segment ====================================================================== Most of these crashes come from previous code not checking for Constraint::GeoUndef. Most of these crashes come from isBSpline(), any of the two overloads. isBSpline is made to throw exception when null, which should prevent the crash while creating a reportable error. --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index acf6ec759b..289791edbd 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -260,11 +260,15 @@ bool SketcherGui::isBsplinePole(const Part::Geometry * geo) { auto gf = GeometryFacade::getFacade(geo); - return gf->getInternalType() == InternalType::BSplineControlPoint; + if(gf) + return gf->getInternalType() == InternalType::BSplineControlPoint; + + THROWM(Base::ValueError, "Null geometry in isBsplinePole - please report") } bool SketcherGui::isBsplinePole(const Sketcher::SketchObject* Obj, int GeoId) { + auto geom = Obj->getGeometry(GeoId); return isBsplinePole(geom);