QmlDesigner: catch RewritingException when moving nodes

found at https://the-qt-company-00.sentry.io/issues/6650630594

Change-Id: Id968abcc08e601694ae612c6cb0c5fa80aa1c9ff
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
(cherry picked from commit adaef5816f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tim Jenßen
2025-06-04 14:27:59 +02:00
committed by Tim Jenssen
parent 1cccc9428b
commit 7ac420e9e8

View File

@@ -67,8 +67,13 @@ inline static void moveNodesUp(const QList<QmlDesigner::ModelNode> &nodes)
index--;
if (index < 0)
index = node.parentProperty().count() - 1; //wrap around
if (oldIndex != index)
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
if (oldIndex != index) {
try {
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
} catch (QmlDesigner::Exception &exception) {
exception.showException();
}
}
}
}
}
@@ -82,8 +87,13 @@ inline static void moveNodesDown(const QList<QmlDesigner::ModelNode> &nodes)
index++;
if (index >= node.parentProperty().count())
index = 0; //wrap around
if (oldIndex != index)
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
if (oldIndex != index) {
try {
node.parentProperty().toNodeListProperty().slide(oldIndex, index);
} catch (QmlDesigner::Exception &exception) {
exception.showException();
}
}
}
}
}