Commit 109cdeda authored by David Faure's avatar David Faure
Browse files

qprintdialog_unix.cpp: fix out-of-bounds when cwd is empty.


This happens when the cwd got deleted meanwhile; this warning is printed out:
QFileSystemEngine::currentPath: getcwd() failed
and currentPath() is empty. Not a problem in itself, but qprintdialog
should not assume it's not empty, then.

Change-Id: I5c89992b36ca58b6325ced399cff33aca9efb7ec
Reviewed-by: default avatarThiago Macieira <thiago.macieira@intel.com>
parent 314c83c0
Branches
Tags
No related merge requests found
Showing with 1 addition and 1 deletion
......@@ -803,7 +803,7 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties()
QString cur = QDir::currentPath();
if (home.at(home.length()-1) != QLatin1Char('/'))
home += QLatin1Char('/');
if (cur.at(cur.length()-1) != QLatin1Char('/'))
if (!cur.isEmpty() && cur.at(cur.length()-1) != QLatin1Char('/'))
cur += QLatin1Char('/');
if (cur.left(home.length()) != home)
cur = home;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment