]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix possible crash in KFileItemModel::slotRefreshItems()
authorFrank Reininghaus <frank78ac@googlemail.com>
Sat, 10 Sep 2011 19:55:27 +0000 (21:55 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sat, 10 Sep 2011 19:55:27 +0000 (21:55 +0200)
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).

src/kitemviews/kfileitemmodel.cpp

index c0287340ee7039c2fb67c4cf35bcfb764f5cc7c7..ca15837529282f60dcb7728d0950b671ba6468b4 100644 (file)
@@ -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);