mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Add explicit error handling when filesCount() returns negative value
Fix coverity CID 162538
This commit is contained in:
parent
562080de69
commit
d8c0a40b1f
1 changed files with 3 additions and 1 deletions
|
@ -2053,8 +2053,10 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
|
|||
|
||||
QVector<qreal> TorrentHandle::availableFileFractions() const
|
||||
{
|
||||
QVector<int> piecesAvailability = pieceAvailability();
|
||||
const auto filesCount = this->filesCount();
|
||||
if (filesCount < 0) return {};
|
||||
|
||||
const QVector<int> piecesAvailability = pieceAvailability();
|
||||
// libtorrent returns empty array for seeding only torrents
|
||||
if (piecesAvailability.empty()) return QVector<qreal>(filesCount, -1.);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue