mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Fix another potential crash when memory allocation failed.
See commit e95fce3084
.
Related issues #3877 and #2673.
This commit is contained in:
parent
cc9ffc4767
commit
d60f2fc7df
1 changed files with 5 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <QDebug>
|
||||||
#include "downloadedpiecesbar.h"
|
#include "downloadedpiecesbar.h"
|
||||||
|
|
||||||
DownloadedPiecesBar::DownloadedPiecesBar(QWidget *parent): QWidget(parent)
|
DownloadedPiecesBar::DownloadedPiecesBar(QWidget *parent): QWidget(parent)
|
||||||
|
@ -150,6 +151,10 @@ void DownloadedPiecesBar::updateImage()
|
||||||
{
|
{
|
||||||
// qDebug() << "updateImage";
|
// qDebug() << "updateImage";
|
||||||
QImage image2(width() - 2, 1, QImage::Format_RGB888);
|
QImage image2(width() - 2, 1, QImage::Format_RGB888);
|
||||||
|
if (image2.isNull()) {
|
||||||
|
qDebug() << "QImage image2() allocation failed, width():" << width();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_pieces.isEmpty()) {
|
if (m_pieces.isEmpty()) {
|
||||||
image2.fill(0xffffff);
|
image2.fill(0xffffff);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue