summaryrefslogtreecommitdiffstats
path: root/src/plugins/printsupport
diff options
context:
space:
mode:
authorDyami Caliri <dyami@dragonframe.com>2014-06-19 11:56:17 -0700
committerDyami Caliri <dyami@dragonframe.com>2014-06-20 17:29:32 +0200
commit3226a71a89f63fc590d1fa371c96bdd1dbe1e286 (patch)
treef387734d86cb19881ac75d3a1a0f0aede95f89a5 /src/plugins/printsupport
parent70dd5630463cb8aabd927a3a4944aedbd90b70af (diff)
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>
Diffstat (limited to 'src/plugins/printsupport')
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintdevice.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
index 2c75ab7016..915d8380c7 100644
--- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
@@ -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;