Skip to content

Commit

Permalink
Sketcher: Fix crash when creating an angle constrain on a line segment
Browse files Browse the repository at this point in the history
======================================================================

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.
  • Loading branch information
abdullahtahiriyo committed Dec 19, 2020
1 parent 70f8550 commit 985f351
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Mod/Sketcher/Gui/CommandConstraints.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 985f351

Please sign in to comment.