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
Q_ASSERT(modelNode().property("changes").isNodeListProperty());
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
//### exception if not valid QmlModelStateOperation
if (QmlModelStateOperation(childNode).target() == node)
returnList.append(QmlModelStateOperation(childNode)); //### exception if not valid(childNode);
QmlModelStateOperation stateOperation(childNode);
if (stateOperation.isValid()) {
ModelNode targetNode = stateOperation.target();
if (targetNode.isValid()
&& targetNode == node)
returnList.append(stateOperation); //### exception if not valid(childNode);
}
}
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