make sure that the passed 'self' pointer to a method of the Python wrapper is never null
This commit is contained in:
parent
294b2308d6
commit
09846721f2
|
@ -460,6 +460,12 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject
|
|||
PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject *args)
|
||||
-
|
||||
{
|
||||
// make sure that not a null pointer is passed
|
||||
if (!self) {
|
||||
PyErr_SetString(PyExc_TypeError, "descriptor '@i.Name@' of '@self.export.Namespace@.@self.export.Twin@' object needs an argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// test if twin object not allready deleted
|
||||
if (!static_cast<PyObjectBase*>(self)->isValid()) {
|
||||
PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
|
||||
|
|
Loading…
Reference in New Issue
Block a user