Skip to content

Commit

Permalink
BUG: vtkPythonUtil: Check if vtkPythonMap is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfr committed May 26, 2016
1 parent 61b8743 commit d382a3b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Wrapping/PythonCore/vtkPythonUtil.cxx
Expand Up @@ -437,7 +437,7 @@ PyObject *vtkPythonUtil::GetObjectFromPointer(vtkObjectBase *ptr)
{
PyObject *obj = NULL;

if (ptr)
if (ptr && vtkPythonMap)
{
vtkPythonObjectMap::iterator i =
vtkPythonMap->ObjectMap->find(ptr);
Expand Down Expand Up @@ -777,6 +777,12 @@ PyObject *vtkPythonUtil::GetObjectFromObject(
void *vtkPythonUtil::GetPointerFromSpecialObject(
PyObject *obj, const char *result_type, PyObject **newobj)
{
if (vtkPythonMap == NULL)
{
PyErr_SetString(PyExc_TypeError, "method requires a vtkPythonMap");
return NULL;
}

const char *object_type =
vtkPythonUtil::StripModule(Py_TYPE(obj)->tp_name);

Expand Down

0 comments on commit d382a3b

Please sign in to comment.