Merge pull request #6848 from evsh/fix-piecebar-crash

Fix crash in download piece bar
This commit is contained in:
Eugene Shalygin 2017-05-27 13:24:14 +02:00 committed by GitHub
commit ae5932a573

View file

@ -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))