From 88d3195164eb611f13aa9ac4bb8f45e08a38fef6 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Fri, 7 Apr 2017 14:54:18 +0200 Subject: [PATCH] QWindowsPrintDevice: Handle 0 from DocumentProperties correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-55090 Change-Id: I5fadd0f007c826ab6747f319dbf3eaee5f208a44 Reviewed-by: Michael BrĂ¼ning --- src/plugins/printsupport/windows/qwindowsprintdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp index 7e6eb7c559a..99e8ec89993 100644 --- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp +++ b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp @@ -86,7 +86,7 @@ static LPDEVMODE getDevmode(HANDLE hPrinter, const QString &printerId) LPWSTR printerIdUtf16 = const_cast(reinterpret_cast(printerId.utf16())); // Allocate the required DEVMODE buffer LONG dmSize = DocumentProperties(NULL, hPrinter, printerIdUtf16, NULL, NULL, 0); - if (dmSize < 0) + if (dmSize <= 0) return Q_NULLPTR; LPDEVMODE pDevMode = reinterpret_cast(malloc(dmSize)); // Get the default DevMode