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:
parent
49fea13e6d
commit
88d3195164
@ -86,7 +86,7 @@ static LPDEVMODE getDevmode(HANDLE hPrinter, const QString &printerId)
|
|||||||
LPWSTR printerIdUtf16 = const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(printerId.utf16()));
|
LPWSTR printerIdUtf16 = const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(printerId.utf16()));
|
||||||
// Allocate the required DEVMODE buffer
|
// Allocate the required DEVMODE buffer
|
||||||
LONG dmSize = DocumentProperties(NULL, hPrinter, printerIdUtf16, NULL, NULL, 0);
|
LONG dmSize = DocumentProperties(NULL, hPrinter, printerIdUtf16, NULL, NULL, 0);
|
||||||
if (dmSize < 0)
|
if (dmSize <= 0)
|
||||||
return Q_NULLPTR;
|
return Q_NULLPTR;
|
||||||
LPDEVMODE pDevMode = reinterpret_cast<LPDEVMODE>(malloc(dmSize));
|
LPDEVMODE pDevMode = reinterpret_cast<LPDEVMODE>(malloc(dmSize));
|
||||||
// Get the default DevMode
|
// Get the default DevMode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user