mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Use out of range value when the number of files can't be determined
Trying to get the number of files of a torrent with no metadata causes a crash. Prevent this by first checking if the metadata is available. If the number of files can't be determined, -1 will be returned. Closes #2522.
This commit is contained in:
parent
0cab34aa11
commit
52c8a570e1
1 changed files with 2 additions and 0 deletions
|
@ -243,6 +243,8 @@ bool QTorrentHandle::has_filtered_pieces() const
|
||||||
|
|
||||||
int QTorrentHandle::num_files() const
|
int QTorrentHandle::num_files() const
|
||||||
{
|
{
|
||||||
|
if (!has_metadata())
|
||||||
|
return -1;
|
||||||
#if LIBTORRENT_VERSION_NUM < 10000
|
#if LIBTORRENT_VERSION_NUM < 10000
|
||||||
return torrent_handle::get_torrent_info().num_files();
|
return torrent_handle::get_torrent_info().num_files();
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue