summaryrefslogtreecommitdiff
path: root/src/declarative
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2013-04-16 14:26:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-17 08:16:22 +0200
commit6a3d99ff1747f725fbdfba0353eb74175156fab8 (patch)
tree7b5f2bc8638f96fd459aba641c8589562e7c5c2e /src/declarative
parent11bac1e6f7b7a0d8be25554dc08917fa1b00d4f8 (diff)
downloadqt4-tools-6a3d99ff1747f725fbdfba0353eb74175156fab8.tar.gz
Prevent crash when moving elements of a ListView's ListModel.
QDeclarativeListView::itemsMoved wasn't checking if its list of visible items was empty before accessing its first element. Task-number: QTBUG-26836 Change-Id: I5ed42889a55026f19e44e44d14080a61fff63b59 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 38b3c4d9ac..0177597c4a 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -3578,7 +3578,8 @@ void QDeclarativeListView::itemsMoved(int from, int to, int count)
}
// Ensure we don't cause an ugly list scroll.
- d->visibleItems.first()->setPosition(d->visibleItems.first()->position() + moveBy);
+ if (!d->visibleItems.isEmpty())
+ d->visibleItems.first()->setPosition(d->visibleItems.first()->position() + moveBy);
d->updateSections();
d->layout();