From 50af3716c956be0f50fdd896925da7af91d5da2c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 1 Dec 2010 13:46:24 +0300 Subject: QPrinterInfo::supportedPaperSizes(): return early if the info is invalid e.g. don't report supported paper sized in any case Merge-request: 2516 Signed-off-by: axis --- src/gui/painting/qprinterinfo_mac.cpp | 2 ++ src/gui/painting/qprinterinfo_unix.cpp | 3 +++ src/gui/painting/qprinterinfo_win.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp index 8d41217..033682a 100644 --- a/src/gui/painting/qprinterinfo_mac.cpp +++ b/src/gui/painting/qprinterinfo_mac.cpp @@ -87,6 +87,8 @@ QList QPrinterInfo::supportedPaperSizes() const const Q_D(QPrinterInfo); QList paperSizes; + if (isNull()) + return paperSizes; PMPrinter cfPrn = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(d->name)); if (!cfPrn) diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp index be24bd7..af2e52a 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/gui/painting/qprinterinfo_unix.cpp @@ -898,6 +898,9 @@ QList QPrinterInfo::supportedPaperSizes() const #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) const Q_D(QPrinterInfo); + if (isNull()) + return d->paperSizes; + if (!d->hasPaperSizes) { d->hasPaperSizes = true; diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/gui/painting/qprinterinfo_win.cpp index f7b6874..2d25063 100644 --- a/src/gui/painting/qprinterinfo_win.cpp +++ b/src/gui/painting/qprinterinfo_win.cpp @@ -100,6 +100,8 @@ QList QPrinterInfo::supportedPaperSizes() const const Q_D(QPrinterInfo); QList paperSizes; + if (isNull()) + return paperSizes; DWORD size = DeviceCapabilities(reinterpret_cast(d->name.utf16()), NULL, DC_PAPERS, NULL, NULL); -- cgit v0.12