From 802e0d32ce95aa102905fc882401b1122522035a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Thu, 3 Sep 2020 18:00:29 +0200 Subject: [PATCH] Fix trying to scale images on null images --- common/gl/yacreader_flow_gl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/gl/yacreader_flow_gl.cpp b/common/gl/yacreader_flow_gl.cpp index 13a3bc58..ad59daf7 100644 --- a/common/gl/yacreader_flow_gl.cpp +++ b/common/gl/yacreader_flow_gl.cpp @@ -1388,7 +1388,10 @@ void YACReaderPageFlowGL::populate(int n) QImage ImageLoaderGL::loadImage(const QString &fileName) { QImage image; - bool result = image.load(fileName); + + if (!image.load(fileName)) { + return QImage(); + } switch (flow->performance) { case low: @@ -1404,9 +1407,6 @@ QImage ImageLoaderGL::loadImage(const QString &fileName) break; //no scaling in ultraHigh } - if (!result) - return QImage(); - return image; } @@ -1493,7 +1493,10 @@ QImage ImageLoaderGL::result() QImage ImageLoaderByteArrayGL::loadImage(const QByteArray &raw) { QImage image; - bool result = image.loadFromData(raw); + + if (!image.loadFromData(raw)) { + return QImage(); + } switch (flow->performance) { case low: @@ -1510,9 +1513,6 @@ QImage ImageLoaderByteArrayGL::loadImage(const QByteArray &raw) break; } - if (!result) - return QImage(); - return image; }