summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2017-03-30 11:28:44 +0200
committerMichael BrĂ¼ning <michael.bruning@qt.io>2017-04-04 07:02:04 +0000
commite2eeb3a66e55d83d003b05505891bf0cbd841bc0 (patch)
treebc3a28d773fbc711e96d476d92b23e839e4a3be9 /src
parentf0fc1606d5b6d2adde30971c0a0ea2495fccd85a (diff)
Handle the case when printing result does not contain any data
Failing to do so would trigger an assert in the PDFium wrapper's constructor. Change-Id: Iaa53b1baa54e6483a4e7e9985ad841ac3cfef940 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index b4605ea8..82720ae3 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -101,6 +101,17 @@ static const int MaxTooltipLength = 1024;
#if defined(ENABLE_PRINTING) && defined(ENABLE_PDF)
static bool printPdfDataOnPrinter(const QByteArray& data, QPrinter& printer)
{
+ if (!data.size()) {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
+ qWarning("Failure to print on printer %ls: Print result data is empty.",
+ qUtf16Printable(printer.printerName()));
+#else
+ qWarning("Failure to print on printer %s: Print result data is empty.",
+ qPrintable(printer.printerName()));
+#endif
+ return false;
+ }
+
QRect printerPageRect = printer.pageRect();
PdfiumDocumentWrapperQt pdfiumWrapper(data.constData(), data.size(), printerPageRect.size());