diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index 81c4fa5e7..f370135ff 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -168,13 +168,14 @@ void AppletInterface::init() } //set parent, both as object hyerarchy and visually - m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this)); - - //set anchors - QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent"); - QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill"); - prop.write(expr.evaluate()); + if (m_qmlObject->rootObject()) { + m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this)); + //set anchors + QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent"); + QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill"); + prop.write(expr.evaluate()); + } geometryChanged(QRectF(), QRectF(x(), y(), width(), height())); emit busyChanged(); }