From 7c64f1d4dce6ac0fd1d26a97ea63413cacb6570a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 19 Oct 2023 15:32:04 +0200 Subject: [PATCH] Examples: Avoid warning about scaling null image Change-Id: I16f75c2c6d05017b99596ca0855e0d86f4a74a6f Reviewed-by: Reviewed-by: Alessandro Portale --- src/plugins/qtsupport/exampleslistmodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 83d1659a5f8..2a48449ef32 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -251,8 +251,11 @@ static QPixmap fetchPixmapAndUpdatePixmapCache(const QString &url) // boundedTo -> don't scale thumbnails up const QSize scaledSize = WelcomePageHelpers::GridItemImageSize.boundedTo(img.size()) * dpr; - pixmap = QPixmap::fromImage( - img.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + const QImage scaled = img.isNull() ? img + : img.scaled(scaledSize, + Qt::KeepAspectRatio, + Qt::SmoothTransformation); + pixmap = QPixmap::fromImage(scaled); pixmap.setDevicePixelRatio(dpr); } } else {