qprintengine_win.cpp: Check access to members of DOCINFO in warning.

DOCINFO::lpszOutput can be 0.

Task-number: QTBUG-48203
Change-Id: Ia3940b5b3200143d8d50caa8f4f44c4b22bfff75
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-09-28 16:41:34 +02:00
parent b7f4346c4f
commit a5f470240f

View File

@ -93,9 +93,10 @@ static QByteArray msgBeginFailed(const char *function, const DOCINFO &d)
{
QString result;
QTextStream str(&result);
str << "QWin32PrintEngine::begin: " << function << " failed, document \""
<< QString::fromWCharArray(d.lpszDocName) << '"';
if (d.lpszOutput[0])
str << "QWin32PrintEngine::begin: " << function << " failed";
if (d.lpszDocName && d.lpszDocName[0])
str << ", document \"" << QString::fromWCharArray(d.lpszDocName) << '"';
if (d.lpszOutput && d.lpszOutput[0])
str << ", file \"" << QString::fromWCharArray(d.lpszOutput) << '"';
return result.toLocal8Bit();
}