From: Michael Jansen Date: Sun, 30 Dec 2012 19:56:59 +0000 (+0100) Subject: Fix crash when browsing bluetooth device. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/fe1e3f240a09c18c721f78713e3c359666c42fed Fix crash when browsing bluetooth device. 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. (cherry picked from commit f0c90a47de3f59e4a98932ae6f0499921d9aa899) --- diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 231bfe077..6c015db37 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -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; }