QWindowsPrintDevice check for NULL pDevMode from PPRINTER_INFO_2
The MSDN documentation states that the pDevMode member of PPRINTER_INFO_2 may be NULL. Task-number: QTBUG-39764 Change-Id: I9c3a4bb565115415dbf45544f3d2391107356610 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
70dd563046
commit
3226a71a89
@ -252,6 +252,9 @@ QMarginsF QWindowsPrintDevice::printableMargins(const QPageSize &pageSize,
|
||||
if (GetPrinter(m_hPrinter, 2, buffer.data(), needed, &needed)) {
|
||||
PPRINTER_INFO_2 info = reinterpret_cast<PPRINTER_INFO_2>(buffer.data());
|
||||
DEVMODE *devMode = info->pDevMode;
|
||||
if (!devMode)
|
||||
return margins;
|
||||
|
||||
HDC pDC = CreateDC(NULL, (LPWSTR)m_id.utf16(), NULL, devMode);
|
||||
if (pageSize.id() == QPageSize::Custom || pageSize.windowsId() <= 0 || pageSize.windowsId() > DMPAPER_LAST) {
|
||||
devMode->dmPaperSize = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user