diff options
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativelistview.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 920b6ae..37c34dc 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -3283,6 +3283,11 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) addedVisible = true; } FxListItem *item = d->createItem(modelIndex + i); + if (!item) { + // broken or no delegate + d->clear(); + return; + } d->visibleItems.insert(insertionIdx, item); pos -= item->size() + d->spacing; item->setPosition(pos); @@ -3313,6 +3318,11 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) addedVisible = true; } FxListItem *item = d->createItem(modelIndex + i); + if (!item) { + // broken or no delegate + d->clear(); + return; + } d->visibleItems.insert(index, item); item->setPosition(pos); added.append(item); @@ -3516,6 +3526,11 @@ void QDeclarativeListView::itemsMoved(int from, int to, int count) FxListItem *movedItem = moved.take(item->index); if (!movedItem) movedItem = d->createItem(item->index); + if (!movedItem) { + // broken or no delegate + d->clear(); + return; + } if (item->index <= firstVisible->index) moveBy -= movedItem->size(); it = d->visibleItems.insert(it, movedItem); |