diff --git a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp index 73370cd9e..238f482cd 100644 --- a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp +++ b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp @@ -142,6 +142,15 @@ static QMutex decrefQueueMutex; static QList decrefQueue; extern "C" void ProcessDecRefQueue(); +// helper overload to give us the semantics we want - return NULL without an exception if the attr doesn't exist +PyObject *PyObject_SafeGetAttrString(PyObject *obj, const char *string) +{ + if(PyObject_HasAttrString(obj, string) == 0) + return NULL; + + return PyObject_GetAttrString(obj, string); +} + void FetchException(QString &typeStr, QString &valueStr, int &finalLine, QList &frames) { PyObject *exObj = NULL, *valueObj = NULL, *tracebackObj = NULL; @@ -170,7 +179,7 @@ void FetchException(QString &typeStr, QString &valueStr, int &finalLine, QList