mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Fix potential crash when memory allocation failed. Closes #3877.
This commit is contained in:
parent
ad5dd8391a
commit
3693b34c2c
1 changed files with 5 additions and 1 deletions
|
@ -28,6 +28,7 @@
|
|||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include <QDebug>
|
||||
#include "pieceavailabilitybar.h"
|
||||
|
||||
//#include <QDebug>
|
||||
|
@ -159,8 +160,11 @@ int PieceAvailabilityBar::mixTwoColors(int &rgb1, int &rgb2, float ratio)
|
|||
|
||||
void PieceAvailabilityBar::updateImage()
|
||||
{
|
||||
// qDebug() << "updateImageAv";
|
||||
QImage image2(width() - 2, 1, QImage::Format_RGB888);
|
||||
if (image2.isNull()) {
|
||||
qDebug() << "QImage image2() allocation failed, width():" << width();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pieces.empty()) {
|
||||
image2.fill(0xffffff);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue