forked from qt-creator/qt-creator
QmlDesigner.NodeInstances: Check if context is not null
This commit is contained in:
@@ -161,11 +161,11 @@ void ObjectNodeInstance::initializePropertyWatcher(const ObjectNodeInstance::Poi
|
|||||||
|
|
||||||
void ObjectNodeInstance::setId(const QString &id)
|
void ObjectNodeInstance::setId(const QString &id)
|
||||||
{
|
{
|
||||||
if (!m_id.isEmpty()) {
|
if (!m_id.isEmpty() && context()) {
|
||||||
context()->engine()->rootContext()->setContextProperty(m_id, 0);
|
context()->engine()->rootContext()->setContextProperty(m_id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!id.isEmpty()) {
|
if (!id.isEmpty() && context()) {
|
||||||
context()->engine()->rootContext()->setContextProperty(id, object()); // will also force refresh of all bindings
|
context()->engine()->rootContext()->setContextProperty(id, object()); // will also force refresh of all bindings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user