From 51b5d02cdfd63d3d88b1c85ea055a7b4d02bcec9 Mon Sep 17 00:00:00 2001 From: Antoine C Date: Thu, 19 Sep 2024 10:20:34 +0100 Subject: [PATCH] fix: prevent quickFX model out of bound --- src/qml/qmlchainpresetmodel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qml/qmlchainpresetmodel.cpp b/src/qml/qmlchainpresetmodel.cpp index 91003702ad4..4a375524333 100644 --- a/src/qml/qmlchainpresetmodel.cpp +++ b/src/qml/qmlchainpresetmodel.cpp @@ -62,8 +62,13 @@ QHash QmlChainPresetModel::roleNames() const { } QVariant QmlChainPresetModel::get(int row) const { - QModelIndex idx = index(row, 0); QVariantMap dataMap; + QModelIndex idx = index(row, 0); + + if (!idx.isValid()) { + return dataMap; + } + for (auto it = kRoleNames.constBegin(); it != kRoleNames.constEnd(); it++) { dataMap.insert(it.value(), data(idx, it.key())); }