From cdc5e8fd6135cf9cb0fdef57f3d00a318a1a5153 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Sat, 21 May 2016 15:30:32 -0400 Subject: [PATCH] addDecorators: Check for null object This prevents potential crashes or undefined behavior when a null object is passed to the method. (cherry picked from commit commontk/PythonQt@751ec46a30829bdcbcdae104ee9609b089a5f193) --- src/PythonQt.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PythonQt.cpp b/src/PythonQt.cpp index 4d01a15bb..9d6cf20aa 100644 --- a/src/PythonQt.cpp +++ b/src/PythonQt.cpp @@ -1560,6 +1560,10 @@ PythonQtClassInfo* PythonQtPrivate::currentClassInfoForClassWrapperCreation() void PythonQtPrivate::addDecorators(QObject* o, int decoTypes) { + if (o == nullptr) + { + return; + } o->setParent(this); int numMethods = o->metaObject()->methodCount(); for (int i = 0; i < numMethods; i++) {