diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index f948712fda..f3215511e0 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -1627,6 +1627,11 @@ PyObject* Application::sCoinRemoveAllChildren(PyObject * /*self*/, PyObject *arg PY_TRY { void* ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin","_p_SoGroup", pynode, &ptr, 0); + if (!ptr) { + PyErr_SetString(PyExc_RuntimeError, "Conversion of coin.SoGroup failed"); + return nullptr; + } + coinRemoveAllChildren(static_cast(ptr)); Py_Return; } diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp index 4936080ce2..3bd3da248d 100644 --- a/src/Gui/View3DPy.cpp +++ b/src/Gui/View3DPy.cpp @@ -1172,6 +1172,9 @@ Py::Object View3DInventorPy::dumpNode(const Py::Tuple& args) void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", object, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of SoNode failed"); + } } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -2171,6 +2174,9 @@ Py::Object View3DInventorPy::addEventCallbackPivy(const Py::Tuple& args) void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoType *", proxy, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of SoType failed"); + } } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -2213,6 +2219,9 @@ Py::Object View3DInventorPy::removeEventCallbackPivy(const Py::Tuple& args) void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoType *", proxy, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of SoType failed"); + } } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -2303,6 +2312,9 @@ Py::Object View3DInventorPy::addDraggerCallback(const Py::Tuple& args) void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDragger *", dragger, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of SoDragger failed"); + } } catch (const Base::Exception&) { throw Py::TypeError("The first argument must be of type SoDragger"); @@ -2355,6 +2367,9 @@ Py::Object View3DInventorPy::removeDraggerCallback(const Py::Tuple& args) void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDragger *", dragger, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of SoDragger failed"); + } } catch (const Base::Exception&) { throw Py::TypeError("The first argument must be of type SoDragger"); diff --git a/src/Gui/View3DViewerPy.cpp b/src/Gui/View3DViewerPy.cpp index 5ae4a4cb74..f8026a1236 100644 --- a/src/Gui/View3DViewerPy.cpp +++ b/src/Gui/View3DViewerPy.cpp @@ -220,6 +220,9 @@ Py::Object View3DInventorViewerPy::setSceneGraph(const Py::Tuple& args) void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", proxy, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of coin.SoNode failed"); + } auto node = static_cast(ptr); _viewer->setSceneGraph(node); return Py::None(); @@ -397,6 +400,9 @@ Py::Object View3DInventorViewerPy::setupEditingRoot(const Py::Tuple& args) if(pynode!=Py_None) { void* ptr = nullptr; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", pynode, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of coin.SoNode failed"); + } node = static_cast(ptr); } _viewer->setupEditingRoot(node,mat); diff --git a/src/Gui/ViewProviderPyImp.cpp b/src/Gui/ViewProviderPyImp.cpp index 066ae1bd19..0471b7d33d 100644 --- a/src/Gui/ViewProviderPyImp.cpp +++ b/src/Gui/ViewProviderPyImp.cpp @@ -319,6 +319,10 @@ PyObject* ViewProviderPy::addDisplayMode(PyObject * args) void* ptr = nullptr; try { Base::Interpreter().convertSWIGPointerObj("pivy.coin","_p_SoNode", obj, &ptr, 0); + if (!ptr) { + PyErr_SetString(PyExc_RuntimeError, "Conversion of coin.SoNode failed"); + return nullptr; + } } catch (const Base::Exception& e) { PyErr_SetString(PyExc_RuntimeError, e.what()); diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index b2b7c78b52..98ffcf02f1 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -2263,6 +2263,9 @@ private: try { TopoShape* shape = new TopoShape(); Base::Interpreter().convertSWIGPointerObj("OCC.TopoDS","TopoDS_Shape *", proxy, &ptr, 0); + if (!ptr) { + throw Py::RuntimeError("Conversion of OCC.TopoDS.TopoDS_Shape failed"); + } TopoDS_Shape* s = static_cast(ptr); shape->setShape(*s); return Py::asObject(new TopoShapePy(shape));