Sketch: [skip ci] handle possible crashes when decreasing degree of a spline

This commit is contained in:
wmayer
2020-10-23 11:26:15 +02:00
parent fc89f4eb0c
commit 4a8201a237
3 changed files with 23 additions and 12 deletions

View File

@@ -1399,19 +1399,13 @@ PyObject* SketchObjectPy::increaseBSplineDegree(PyObject *args)
PyObject* SketchObjectPy::decreaseBSplineDegree(PyObject *args)
{
int GeoId;
int incr = 1;
int decr = 1;
if (!PyArg_ParseTuple(args, "i|i", &GeoId, &incr))
return 0;
if (!PyArg_ParseTuple(args, "i|i", &GeoId, &decr))
return nullptr;
if (this->getSketchObjectPtr()->decreaseBSplineDegree(GeoId, incr)==false) {
std::stringstream str;
str << "Degree decrease failed for: " << GeoId;
PyErr_SetString(PyExc_ValueError, str.str().c_str());
return 0;
}
Py_Return;
bool ok = this->getSketchObjectPtr()->decreaseBSplineDegree(GeoId, decr);
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
PyObject* SketchObjectPy::modifyBSplineKnotMultiplicity(PyObject *args)