diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2021-01-01 11:27:10 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2021-01-01 16:44:09 +0100 |
commit | f0818f6ed8a616dcc94785637039ac21468ef311 (patch) | |
tree | 33e2cd4e4a75b17a71f00040a1564de7206259a3 /src/widgets/widgets/qabstractbutton.cpp | |
parent | e334d6f9a763054d7f290bf6de5e79d205b4e21c (diff) |
QAbstractButton: don't access nullptr in queryButtonList()
When a button has no parent, QAbstractButtonPrivate::queryButtonList()
unconditionally accessed parent which results in a nullptr access. Did
not crash because qt_qFindChildren_helper checks for nullptr and
therefore could only be found with a sanitizer.
Fixes: QTBUG-83865
Change-Id: I591e546e96acba50770935b9c3baaf08b09b833d
Pick-to: 6.0
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Diffstat (limited to 'src/widgets/widgets/qabstractbutton.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 727cd66ed4..de6741c030 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -190,7 +190,9 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const return group->d_func()->buttonList; #endif - QList<QAbstractButton*>candidates = parent->findChildren<QAbstractButton *>(); + if (!parent) + return {}; + QList<QAbstractButton *> candidates = parent->findChildren<QAbstractButton *>(); if (autoExclusive) { auto isNoMemberOfMyAutoExclusiveGroup = [](QAbstractButton *candidate) { return !candidate->autoExclusive() |