Utils: Fix setting the path via slotBrowse()

Amends: 0d7f357294

Change-Id: Iae5e13b5d4d869d7e727f614f540767fca32d770
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2021-08-26 16:58:07 +02:00
parent 59d2f96cf8
commit 2d994620d1

View File

@@ -459,7 +459,8 @@ void PathChooser::slotBrowse()
window()->activateWindow(); window()->activateWindow();
// Delete trailing slashes unless it is "/" only. // Delete trailing slashes unless it is "/" only.
if (newPath.endsWith("/") && newPath.path().size() > 1) { if (!newPath.isEmpty()) {
if (newPath.endsWith("/") && newPath.path().size() > 1)
newPath = newPath.withNewPath(newPath.path().chopped(1)); newPath = newPath.withNewPath(newPath.path().chopped(1));
setFilePath(newPath); setFilePath(newPath);
} }