From d936a080dbc05eb006dd2bcc90196ec89b0738f0 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Wed, 24 Mar 2021 22:30:37 +0100 Subject: [PATCH] Check for empty image --- src/widgets/playingwidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgets/playingwidget.cpp b/src/widgets/playingwidget.cpp index 9100d3d60..7db7dc8d3 100644 --- a/src/widgets/playingwidget.cpp +++ b/src/widgets/playingwidget.cpp @@ -334,8 +334,12 @@ void PlayingWidget::SetImage(const QImage &image) { } void PlayingWidget::ScaleCover() { - pixmap_cover_ = QPixmap::fromImage(ImageUtils::ScaleAndPad(image_original_, cover_loader_options_.scale_output_image_, cover_loader_options_.pad_output_image_, cover_loader_options_.desired_height_)); + + QImage image = ImageUtils::ScaleAndPad(image_original_, cover_loader_options_.scale_output_image_, cover_loader_options_.pad_output_image_, cover_loader_options_.desired_height_); + if (image.isNull()) pixmap_cover_ = QPixmap(); + else pixmap_cover_ = QPixmap::fromImage(image); update(); + } void PlayingWidget::SetHeight(int height) {