From: Frank Reininghaus Date: Sat, 10 Sep 2011 19:55:27 +0000 (+0200) Subject: Fix possible crash in KFileItemModel::slotRefreshItems() X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/93b4d607279df05d46b1d3badc073c88fe262762 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). --- 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 >& } } + // 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);