Commit 6d1b0857 authored by Kai Koehne's avatar Kai Koehne

QmlDesigner: Fix crash when deleting an item for a malformed qml file

This fixes a crash when editing a file where e.g. PropertyChanges had
an invalid target property.

Reviewed-by: Lasse Holmstedt
parent 98e8813c
...@@ -79,9 +79,13 @@ QList<QmlModelStateOperation> QmlModelState::stateOperations(const ModelNode &no ...@@ -79,9 +79,13 @@ QList<QmlModelStateOperation> QmlModelState::stateOperations(const ModelNode &no
Q_ASSERT(modelNode().property("changes").isNodeListProperty()); Q_ASSERT(modelNode().property("changes").isNodeListProperty());
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) { foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
//### exception if not valid QmlModelStateOperation QmlModelStateOperation stateOperation(childNode);
if (QmlModelStateOperation(childNode).target() == node) if (stateOperation.isValid()) {
returnList.append(QmlModelStateOperation(childNode)); //### exception if not valid(childNode); ModelNode targetNode =;
if (targetNode.isValid()
&& targetNode == node)
returnList.append(stateOperation); //### exception if not valid(childNode);
} }
return returnList; //not found return returnList; //not found
} }
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