From ed4644bd875bce2bb797a96652b4aced9eb75976 Mon Sep 17 00:00:00 2001 From: Michael Jansen Date: Sun, 30 Dec 2012 20:56:59 +0100 Subject: 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. --- src/kitemviews/kfileitemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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; } -- cgit v1.3