Skip to content

Commit cdc5e8f

Browse files
committed
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@751ec46)
1 parent 86eb0eb commit cdc5e8f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/PythonQt.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,10 @@ PythonQtClassInfo* PythonQtPrivate::currentClassInfoForClassWrapperCreation()
15601560

15611561
void PythonQtPrivate::addDecorators(QObject* o, int decoTypes)
15621562
{
1563+
if (o == nullptr)
1564+
{
1565+
return;
1566+
}
15631567
o->setParent(this);
15641568
int numMethods = o->metaObject()->methodCount();
15651569
for (int i = 0; i < numMethods; i++) {

0 commit comments

Comments
 (0)