From 0ab0823d8cd192f67a431174fa02b8975adc8987 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Fri, 13 Nov 2015 16:36:13 -0800 Subject: [PATCH] Fix krunner crash when open "/" path.split may return empty string list if path contains only separator, check the result before access it with last(). REVIEW: 126060 BUG: 355290 FIXED-IN: 5.5.0 --- runners/locations/locationrunner.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runners/locations/locationrunner.cpp b/runners/locations/locationrunner.cpp index cc129659c..63d3f38b4 100644 --- a/runners/locations/locationrunner.cpp +++ b/runners/locations/locationrunner.cpp @@ -135,6 +135,11 @@ static QString convertCaseInsensitivePath(const QString& path) // Split the string on / QStringList dirNames = path.split(QDir::separator(), QString::SkipEmptyParts); + // if split result is empty, path string can only contain separator. + if (dirNames.empty()) { + return QStringLiteral("/"); + } + // Match folders QDir dir(QStringLiteral("/")); for (int i = 0; i < dirNames.size() - 1; i++) {