X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/856e03b7538cb74a991ad18a13708583d8712fdd..e41e579f40ec15c8c20aa3118b7367281ae4f95b:/wxPython/src/libpy.c diff --git a/wxPython/src/libpy.c b/wxPython/src/libpy.c index 7e400062a8..6fe6c00bfb 100644 --- a/wxPython/src/libpy.c +++ b/wxPython/src/libpy.c @@ -5,11 +5,11 @@ * Contains variable linking and pointer type-checking code. ************************************************************************/ +#include "Python.h" + #include #include -#include "Python.h" - #ifdef __cplusplus extern "C" { #endif @@ -402,6 +402,7 @@ SWIGSTATICRUNTIME(char *) SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) { PyObject *sobj = obj; char *str; + if (!PyString_Check(obj)) { if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this"))) return ""; @@ -409,6 +410,8 @@ SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) { Py_DECREF(sobj); } str = PyString_AsString(sobj); + if (str == NULL) + return ""; return SWIG_GetPtr(str,ptr,type); }