Skip to content

Commit

Permalink
App: do not return null Shape in PropertyContainerPy
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder authored and wwmayer committed Aug 30, 2019
1 parent 04d6785 commit 0cb599a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/App/PropertyContainerPyImp.cpp
Expand Up @@ -482,14 +482,12 @@ PyObject *PropertyContainerPy::getCustomAttributes(const char* attr) const
}
Property *prop = getPropertyContainerPtr()->getPropertyByName(attr);
if (prop) {
PY_TRY {
PyObject* pyobj = prop->getPyObject();
if (!pyobj && PyErr_Occurred()) {
// the Python exception is already set
throw Py::Exception();
}
return pyobj;
}PY_CATCH
PyObject* pyobj = prop->getPyObject();
if (!pyobj && PyErr_Occurred()) {
// the Python exception is already set
throw Py::Exception();
}
return pyobj;
}
else if (Base::streq(attr, "__dict__")) {
// get the properties to the C++ PropertyContainer class
Expand Down Expand Up @@ -528,7 +526,12 @@ PyObject *PropertyContainerPy::getCustomAttributes(const char* attr) const
if(_getShape != Py_None) {
Py::Tuple args(1);
args.setItem(0,Py::Object(const_cast<PropertyContainerPy*>(this)));
return PyObject_CallObject(_getShape, args.ptr());
Py::Object res(PyObject_CallObject(_getShape, args.ptr()),true);
if(res.hasAttr("isNull")) {
Py::Callable func(res.getAttr("isNull"));
if(!func.apply().isTrue())
return Py::new_reference_to(res);
}
}
}

Expand Down

0 comments on commit 0cb599a

Please sign in to comment.