QWindowsPrintDevice: Handle 0 from DocumentProperties correctly

Task-number: QTBUG-55090
Change-Id: I5fadd0f007c826ab6747f319dbf3eaee5f208a44
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
This commit is contained in:
Daniel Teske 2017-04-07 14:54:18 +02:00 committed by Michael Brüning
parent 49fea13e6d
commit 88d3195164

View File

@ -86,7 +86,7 @@ static LPDEVMODE getDevmode(HANDLE hPrinter, const QString &printerId)
LPWSTR printerIdUtf16 = const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(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<LPDEVMODE>(malloc(dmSize));
// Get the default DevMode