]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/klistview.cpp
Fix the problem of the crash related to commit 677667, taking in count we are in...
[dolphin.git] / src / klistview.cpp
index 1cba47b1bd44c2c8e785beaa0f5b03bf359a3d4f..7e4259be66ee8be48c937db245187249a9c17cc0 100644 (file)
@@ -21,7 +21,8 @@
 #include "klistview.h"
 #include "klistview_p.h"
 
-#include <math.h> // trunc
+#include <math.h> // trunc on C99 compliant systems
+#include <kdefakes.h> // trunc for not C99 compliant systems
 
 #include <QApplication>
 #include <QPainter>
@@ -955,11 +956,11 @@ void KListView::updateGeometries()
 
 void KListView::slotSortingRoleChanged()
 {
-    if (d->proxyModel)
+    if ((viewMode() == KListView::IconMode) && d->proxyModel &&
+        d->itemCategorizer)
     {
         // Force the view to update all elements
-        rowsInsertedArtifficial(QModelIndex(), 0, d->proxyModel->rowCount() -
-                                                                             1);
+        rowsInsertedArtifficial(QModelIndex(), 0, d->proxyModel->rowCount() - 1);
     }
 }