Core: Check returned pointer of convertSWIGPointerObj
This commit is contained in:
@@ -1577,6 +1577,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<SoGroup*>(ptr));
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<SoNode*>(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<SoNode*>(ptr);
|
||||
}
|
||||
_viewer->setupEditingRoot(node,mat);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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<TopoDS_Shape*>(ptr);
|
||||
shape->setShape(*s);
|
||||
return Py::asObject(new TopoShapePy(shape));
|
||||
|
||||
Reference in New Issue
Block a user