]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix crash when browsing bluetooth device.
authorMichael Jansen <kde@michael-jansen.biz>
Sun, 30 Dec 2012 19:56:59 +0000 (20:56 +0100)
committerMichael Jansen <kde@michael-jansen.biz>
Sun, 30 Dec 2012 19:57:48 +0000 (20:57 +0100)
When trying to browse a N900 it crashed here because pathA was empty. Which
lead to index = maxIndex beeing -1 and pathA.at(index) crashing.

Reorder the while condition to prevent that courtesy of tsdgeos.

src/kitemviews/kfileitemmodel.cpp

index 231bfe077e2d12ce195f38d42f65fbc5b0a241b5..6c015db372cdb1df85995e56c3d79560cc21b97a 100644 (file)
@@ -1499,7 +1499,7 @@ int KFileItemModel::expandedParentsCountCompare(const ItemData* a, const ItemDat
     if (index > maxIndex) {
         index = maxIndex;
     }
-    while ((pathA.at(index) != QLatin1Char('/') || pathB.at(index) != QLatin1Char('/')) && index > 0) {
+    while (index > 0 && (pathA.at(index) != QLatin1Char('/') || pathB.at(index) != QLatin1Char('/'))) {
         --index;
     }