From 998954db6d53999dfa75d380cbb4ca3111589f66 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Sun, 4 Aug 2013 21:46:08 +0200 Subject: [PATCH] Fix possible out of range error inKItemListSizeHintResolver::itemsMoved The function assumes implicitly that the moved range always starts with the index 0. This is indeed the case at the moment, but it might make sense to change that in the future. This commit prevents that we get an out of range problem then. Thanks to Emmanuel Pescosta for finding this problem, see https://git.reviewboard.kde.org/r/111808/ --- dolphin/src/kitemviews/private/kitemlistsizehintresolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphin/src/kitemviews/private/kitemlistsizehintresolver.cpp b/dolphin/src/kitemviews/private/kitemlistsizehintresolver.cpp index e44630243b..c86ce2bf85 100644 --- a/dolphin/src/kitemviews/private/kitemlistsizehintresolver.cpp +++ b/dolphin/src/kitemviews/private/kitemlistsizehintresolver.cpp @@ -120,7 +120,7 @@ void KItemListSizeHintResolver::itemsMoved(const KItemRange& range, const QList< const int movedRangeEnd = range.index + range.count; for (int i = range.index; i < movedRangeEnd; ++i) { - const int newIndex = movedToIndexes.at(i); + const int newIndex = movedToIndexes.at(i - range.index); newSizeHintCache[newIndex] = m_sizeHintCache.at(i); }