0000497: FreeCAD crashes when calling Part.makeFilledFace with list of lines

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5197 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer 2011-11-28 14:44:34 +00:00
parent c91caf2707
commit 25755de65e

View File

@ -358,15 +358,23 @@ static PyObject * makeFilledFace(PyObject *self, PyObject *args)
try {
Py::List list(obj);
int countEdges = 0;
for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapeEdgePy::Type))) {
const TopoDS_Shape& sh = static_cast<TopoShapeEdgePy*>((*it).ptr())->
getTopoShapePtr()->_Shape;
if (!sh.IsNull())
if (!sh.IsNull()) {
builder.Add(TopoDS::Edge(sh), GeomAbs_C0);
countEdges++;
}
}
}
if (countEdges == 0) {
PyErr_SetString(PyExc_Exception, "Failed to created face with no edges");
return 0;
}
builder.Build();
if (builder.IsDone()) {
return new TopoShapeFacePy(new TopoShape(builder.Face()));