aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-04-25 23:37:33 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-04-25 21:38:41 +0000
commitac1d446c1356ec8e11d1bf14b5559c682079b70c (patch)
tree52967cb35cadcbbcb672c603ece23f8c9329dced /src
parent2f55a4926347a6f6b445efca7dfed792e1bacc57 (diff)
ExclusiveGroup: don't crash when passing null
Change-Id: I4d6f555faac81e56c32c6baf0a9ede14849a5855 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/qquickexclusivegroup.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/controls/qquickexclusivegroup.cpp b/src/controls/qquickexclusivegroup.cpp
index 5144bf92..8eec97ab 100644
--- a/src/controls/qquickexclusivegroup.cpp
+++ b/src/controls/qquickexclusivegroup.cpp
@@ -107,6 +107,9 @@ void QQuickExclusiveGroup::setCurrent(QObject *current)
*/
void QQuickExclusiveGroup::addCheckable(QObject *object)
{
+ if (!object)
+ return;
+
connect(object, SIGNAL(checkedChanged()), this, SLOT(_q_updateCurrent()), Qt::UniqueConnection);
connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(removeCheckable(QObject*)), Qt::UniqueConnection);
@@ -122,6 +125,9 @@ void QQuickExclusiveGroup::addCheckable(QObject *object)
void QQuickExclusiveGroup::removeCheckable(QObject *object)
{
Q_D(QQuickExclusiveGroup);
+ if (!object)
+ return;
+
if (object->metaObject()->indexOfProperty("checked") != -1)
disconnect(object, SIGNAL(checkedChanged()), this, SLOT(_q_updateCurrent()));
disconnect(object, SIGNAL(destroyed(QObject*)), this, SLOT(removeCheckable(QObject*)));