Check for a null scene object
Under certain unusual circumstances getSceneGraph can be called when the scene is null, causing a native exception when the scene's reference count is incremented. This changes the code to return python None in this condition, allowing the calling cod eto handle the no-scene case itself.
This commit is contained in:
committed by
Kacper Donat
parent
63ed3e8dff
commit
75b55658a7
@@ -2135,6 +2135,9 @@ Py::Object View3DInventorPy::getSceneGraph()
|
||||
{
|
||||
try {
|
||||
SoNode* scene = getView3DInventorPtr()->getViewer()->getSceneGraph();
|
||||
if (scene == nullptr) {
|
||||
return Py::None();
|
||||
}
|
||||
PyObject* proxy = nullptr;
|
||||
proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", "SoSeparator *", static_cast<void*>(scene), 1);
|
||||
scene->ref();
|
||||
|
||||
Reference in New Issue
Block a user