diff options
| author | Frank Reininghaus <[email protected]> | 2011-09-10 21:55:27 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2011-09-10 21:55:27 +0200 |
| commit | 93b4d607279df05d46b1d3badc073c88fe262762 (patch) | |
| tree | 1eb24ce96ea9e7980fca6255f909a5e373f017f9 | |
| parent | ff243261742ecd70fb9e417614e757b5956c04aa (diff) | |
Fix possible crash in KFileItemModel::slotRefreshItems()
If the changed items have been created recently, they might not be in
m_items yet. In that case, the list 'indexes' might be empty, which
leads to a crash later on (I saw the crash in KFileItemModel's unit
test).
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index c0287340e..ca1583752 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -438,6 +438,12 @@ void KFileItemModel::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >& } } + // If the changed items have been created recently, they might not be in m_items yet. + // In that case, the list 'indexes' might be empty. + if (indexes.isEmpty()) { + return; + } + // Extract the item-ranges out of the changed indexes qSort(indexes); |
