Guard failed testItem creation

Summary: createObjectFromSource can return a null on error. This needs guarding.

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D7532
This commit is contained in:
David Edmundson 2017-08-25 10:21:49 +01:00
parent 2236c19584
commit a968892ba9

View File

@ -676,7 +676,9 @@ QObject *AppletQuickItem::testItem()
}
d->testItem = d->qmlObject->createObjectFromSource(url, QtQml::qmlContext(rootItem()));
d->testItem->setProperty("plasmoidItem", QVariant::fromValue<QObject*>(this));
if (d->testItem) {
d->testItem->setProperty("plasmoidItem", QVariant::fromValue<QObject*>(this));
}
}
return d->testItem;