From 4bcc371dfbb26dc5275ece8be465f4251d2fc5ad Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 15 Sep 2020 16:23:03 +0200 Subject: [PATCH] QmlDesigner: Fix QTC_ASSERT The ModelNode has to be always valid, but not the QmlItemNode. Change-Id: I906f2f6ec101b5d19223a3b5103c81c76f2585fe Reviewed-by: Tim Jenssen --- .../components/propertyeditor/qmlanchorbindingproxy.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp index b4ec89d3687..dc3ed7c30ee 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp @@ -894,7 +894,11 @@ QmlItemNode QmlAnchorBindingProxy::targetIdToNode(const QString &id) const QString QmlAnchorBindingProxy::idForNode(const QmlItemNode &qmlItemNode) const { - QTC_ASSERT(qmlItemNode.isValid(), return {}); + QTC_ASSERT(qmlItemNode.modelNode().isValid(), return {}); + + if (!qmlItemNode.isValid()) + return qmlItemNode.id(); + if (m_qmlItemNode.instanceParent().modelNode() == qmlItemNode) return QStringLiteral("parent");