From 25755de65e7ae6023cd9629aab3066389a55762e Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 28 Nov 2011 14:44:34 +0000 Subject: [PATCH] 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 --- src/Mod/Part/App/AppPartPy.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 69948f597..763f6da53 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -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((*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()));