From b263c2aa87a7e385322a7a05bccb4ab5e0991ceb Mon Sep 17 00:00:00 2001 From: marioalexis Date: Sun, 10 Jan 2021 23:05:14 -0300 Subject: [PATCH] Part: Crash when calling SubShapes of empty shape from Python --- src/Mod/Part/App/TopoShapePyImp.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index 4b4870ca06..3ea305a027 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -2972,8 +2972,13 @@ void TopoShapePy::setOrientation(Py::String arg) Py::List TopoShapePy::getSubShapes(void) const { Py::List ret; - for(TopoDS_Iterator it(getTopoShapePtr()->getShape());it.More();it.Next()) - ret.append(shape2pyshape(it.Value())); + const TopoDS_Shape& shape = getTopoShapePtr()->getShape(); + + if (!shape.IsNull()) { + for(TopoDS_Iterator it(shape);it.More();it.Next()) + ret.append(shape2pyshape(it.Value())); + } + return ret; }