mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-12 18:24:58 +08:00
Fix crash in download piece bar
When torrent size is smaller than the image width, bytes per pixel was set to zero and code was crashing. Set it to -1 instead, as we do when image is empty. This will disable highliting, but our algorithm does not work in this case anyway.
This commit is contained in:
parent
47960b2592
commit
6d9eec0e71
@ -50,7 +50,8 @@ namespace
|
||||
{
|
||||
public:
|
||||
PieceIndexToImagePos(const BitTorrent::TorrentInfo &torrentInfo, const QImage &image)
|
||||
: m_bytesPerPixel {image.width() > 0 ? torrentInfo.totalSize() / image.width() : -1}
|
||||
: m_bytesPerPixel {(image.width() > 0 && torrentInfo.totalSize() >= image.width())
|
||||
? torrentInfo.totalSize() / image.width() : -1}
|
||||
, m_torrentInfo {torrentInfo}
|
||||
{
|
||||
if ((m_bytesPerPixel > 0) && (m_bytesPerPixel < 10))
|
||||
|
Loading…
Reference in New Issue
Block a user