Commit 174eb7c2 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner.NodeInstances: Fix crash for instance without object

Change-Id: Ia08cdb194e8f67a71cdbddf162cc7f17daa517f8
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 19c561c5
......@@ -213,9 +213,18 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
object = Internal::ObjectNodeInstance::createPrimitive(instanceContainer.type(), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
}
if ((object == 0) && (instanceContainer.metaType() == InstanceContainer::ItemMetaType)) //If we cannot instanciate the object but we know it has to be an Ttem, we create an Item instead.
if (object == 0) {
if (instanceContainer.metaType() == InstanceContainer::ItemMetaType) { //If we cannot instanciate the object but we know it has to be an Ttem, we create an Item instead.
object = Internal::ObjectNodeInstance::createPrimitive("QtQuick/Item", 2, 0, nodeInstanceServer->context());
if (object == 0)
object = new QQuickItem;
} else {
object = new QObject;
}
}
QQmlEnginePrivate::get(nodeInstanceServer->engine())->cache(object->metaObject());
ServerNodeInstance instance(createInstance(object));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment