diff --git a/qtdeclarative/src/quickdialogs/quickdialogsquickimpl/qquickfiledialogimpl.cpp b/qtdeclarative/src/quickdialogs/quickdialogsquickimpl/qquickfiledialogimpl.cpp index 51493f883..860c4b5f7 100644 --- a/qtdeclarative/src/quickdialogs/quickdialogsquickimpl/qquickfiledialogimpl.cpp +++ b/qtdeclarative/src/quickdialogs/quickdialogsquickimpl/qquickfiledialogimpl.cpp @@ -97,7 +97,9 @@ void QQuickFileDialogImplPrivate::updateSelectedFile(const QString &oldFolderPat // /foo/bar/baz/abc/xyz // [rel...Paths] QStringList relativePaths = oldFolderPath.mid(indexOfFolder + newFolderPath.size()).split(QLatin1Char('/'), Qt::SkipEmptyParts); - newSelectedFilePath = newFolderPath + QLatin1Char('/') + relativePaths.first(); + newSelectedFilePath = newFolderPath; + if (relativePaths.size() > 0) + newSelectedFilePath += QLatin1Char('/') + relativePaths.first(); // Now find the index of that directory so that we can set the ListView's currentIndex to it. const QDir newFolderDir(newFolderPath);