diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 753d83156f..740de27155 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1340,7 +1340,16 @@ static QString canonicalPath(const QString &path) { QFileInfo selFile(path); if (!selFile.exists()) { - return canonicalPath(selFile.dir().path()) + '/' + selFile.fileName(); + const auto parentPath = selFile.dir().path(); + + // It's possible for the parentPath to match the path + // (possibly we've arrived at a non-existant drive root on Windows) + // and recursing would be fatal. + if (parentPath == path) { + return path; + } + + return canonicalPath(parentPath) + '/' + selFile.fileName(); } return selFile.canonicalFilePath(); }