From e4abb59d3a2dd2fd90435644ae6b39d2dc204d6d Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 24 Jan 2016 15:47:28 +0100 Subject: [PATCH] QzTools: Return empty url when pixmap is null in pixmapToDataUrl --- src/lib/tools/qztools.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index 7dc9c2c9d..bc3940b86 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -77,7 +77,8 @@ QPixmap QzTools::pixmapFromByteArray(const QByteArray &data) QUrl QzTools::pixmapToDataUrl(const QPixmap &pix) { - return QUrl(QSL("data:image/png;base64,") + QString(pixmapToByteArray(pix))); + const QString data(pixmapToByteArray(pix)); + return data.isEmpty() ? QUrl() : QUrl(QSL("data:image/png;base64,") + data); } QString QzTools::readAllFileContents(const QString &filename)