summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-02-23 16:10:44 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-12 10:56:01 +0000
commit3185c4ce6cacaef806aa8c583ab3d7f9269ca15a (patch)
treea6a797e64b38765f2db198e83255c7dd4fbb4403
parent9e9f889a631083ad3f78e7d975f4c8d3d6be39f2 (diff)
qqmldelegatemodel: Fix out of bounds cache removal
Task-number: QTBUG-91276 Change-Id: I1ddbb4a3326d61ff94e3881beb64a14dade11c46 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 31ad81d81e623a34cd71567b9507f16601f1c1d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qmlmodels/qqmldelegatemodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
index 838a0e18e2..4cba2d3f35 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -1608,7 +1608,7 @@ void QQmlDelegateModelPrivate::itemsRemoved(
removed[i] = 0;
for (const Compositor::Remove &remove : removes) {
- for (; cacheIndex < remove.cacheIndex; ++cacheIndex)
+ for (; cacheIndex < remove.cacheIndex && cacheIndex < m_cache.size(); ++cacheIndex)
incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed);
for (int i = 1; i < m_groupCount; ++i) {