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.
This commit is contained in:
Abdullah Tahiri
2020-12-18 17:50:49 +01:00
committed by abdullahtahiriyo
parent 70f85505d0
commit 985f3510f5

View File

@@ -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);