+ fixes #0001690: sketch.getPoint crashes FreeCAD if the point does not exist
This commit is contained in:
parent
92cb03bca1
commit
8808b82371
|
@ -357,7 +357,18 @@ PyObject* SketchObjectPy::getPoint(PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "ii", &GeoId, &PointType))
|
if (!PyArg_ParseTuple(args, "ii", &GeoId, &PointType))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return new Base::VectorPy(new Base::Vector3d(this->getSketchObjectPtr()->getPoint(GeoId,(Sketcher::PointPos)PointType)));
|
if (PointType < 0 || PointType > 3) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "Invalid point type");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SketchObject* obj = this->getSketchObjectPtr();
|
||||||
|
if (GeoId > obj->getHighestCurveIndex() || -GeoId > obj->getExternalGeometryCount()) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "Invalid geometry Id");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Base::VectorPy(new Base::Vector3d(obj->getPoint(GeoId,(Sketcher::PointPos)PointType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* SketchObjectPy::getAxis(PyObject *args)
|
PyObject* SketchObjectPy::getAxis(PyObject *args)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user