From d60f2fc7dffbef33d052f2b7a0e3d2141a8ed8eb Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sat, 17 Oct 2015 18:19:47 +0300 Subject: [PATCH] Fix another potential crash when memory allocation failed. See commit e95fce3084d5d52b6535cc7a8b7dd6883ffcdabd. Related issues #3877 and #2673. --- src/gui/properties/downloadedpiecesbar.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/properties/downloadedpiecesbar.cpp b/src/gui/properties/downloadedpiecesbar.cpp index e0764507e..fdb97671e 100644 --- a/src/gui/properties/downloadedpiecesbar.cpp +++ b/src/gui/properties/downloadedpiecesbar.cpp @@ -29,6 +29,7 @@ */ #include +#include #include "downloadedpiecesbar.h" DownloadedPiecesBar::DownloadedPiecesBar(QWidget *parent): QWidget(parent) @@ -150,6 +151,10 @@ void DownloadedPiecesBar::updateImage() { // qDebug() << "updateImage"; QImage image2(width() - 2, 1, QImage::Format_RGB888); + if (image2.isNull()) { + qDebug() << "QImage image2() allocation failed, width():" << width(); + return; + } if (m_pieces.isEmpty()) { image2.fill(0xffffff);