Commit 2474ae25 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Fix crash while changing code

Especially when the code editor is used types can be invalid.

Task-number: QTCREATORBUG-19079
Change-Id: I4c832c3ce10b7ed10c99ae53470fc79d6a23bfb9
Reviewed-by: Thomas Hartmann's avatarThomas Hartmann <thomas.hartmann@qt.io>
parent 8f91a63c
......@@ -1107,6 +1107,9 @@ bool ModelNode::isComponent() const
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (!metaInfo().isValid())
return false;
if (metaInfo().isFileComponent())
return true;
......@@ -1114,10 +1117,14 @@ bool ModelNode::isComponent() const
return true;
if (metaInfo().isView() && hasNodeProperty("delegate")) {
if (nodeProperty("delegate").modelNode().metaInfo().isFileComponent())
const ModelNode delegateNode = nodeProperty("delegate").modelNode();
if (delegateNode.hasMetaInfo()) {
const NodeMetaInfo delegateMetaInfo = delegateNode.metaInfo();
if (delegateMetaInfo.isValid() && delegateMetaInfo.isFileComponent())
return true;
}
if (nodeProperty("delegate").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource)
if (delegateNode.nodeSourceType() == ModelNode::NodeWithComponentSource)
return true;
}
......
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