aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-02-13 14:08:19 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-15 14:46:35 +0100
commitaf8c15951886ffb10e1ea8a0631e3ea7e29da483 (patch)
tree81429dd687cd5aa08a4c4623b881009566acae09 /src/imports
parent42f230fb9bc04d32774f05e9358604720662490a (diff)
FolderListModel: prevent assertion failure when filter selects 0 files
If you do nameFilters = "*.foo" and there are no matching files, there was an assertion failure due to inserting rows from 0 to -1: ASSERT: "last >= first" in file itemmodels/qabstractitemmodel.cpp Change-Id: I4a3642906a4588bebc699b8d99438726676fb4ca Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index 3e3a824648..421e215066 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -159,8 +159,10 @@ void QQuickFolderListModelPrivate::_q_directoryUpdated(const QString &directory,
data = list;
q->beginRemoveRows(parent, fromIndex, toIndex);
q->endRemoveRows();
- q->beginInsertRows(parent, fromIndex, list.size()-1);
- q->endInsertRows();
+ if (list.size() > 0) {
+ q->beginInsertRows(parent, fromIndex, list.size()-1);
+ q->endInsertRows();
+ }
emit q->rowCountChanged();
} else if (data.size() < list.size()) {
//qDebug() << "File added. FromIndex: " << fromIndex << " toIndex: " << toIndex << " list size: " << list.size();