diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 400417daf..a0753b043 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -460,7 +460,7 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) { if (type) { #if defined(SWIG_COBJECT_TYPES) - if (PySwigObject_Check(obj)) { + if (obj && PySwigObject_Check(obj)) { const char *otype = (const char *) PySwigObject_GetDesc(obj); if (otype) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",