merge runtime-checks instead of asserts fix from RC_0_16

This commit is contained in:
Arvid Norberg 2013-05-29 03:30:33 +00:00
parent fcff3e0e00
commit fb81f96626
1 changed files with 2 additions and 4 deletions

View File

@ -4065,9 +4065,9 @@ namespace libtorrent
// this call is only valid on torrents with metadata
if (!valid_metadata() || is_seed()) return;
TORRENT_ASSERT(index < m_torrent_file->num_files());
TORRENT_ASSERT(index >= 0);
if (index < 0 || index >= m_torrent_file->num_files()) return;
if (prio < 0) prio = 0;
else if (prio > 7) prio = 7;
if (m_file_priority.size() <= index)
{
if (prio == 1) return;
@ -4083,8 +4083,6 @@ namespace libtorrent
// this call is only valid on torrents with metadata
if (!valid_metadata()) return 1;
TORRENT_ASSERT(index < m_torrent_file->num_files());
TORRENT_ASSERT(index >= 0);
if (index < 0 || index >= m_torrent_file->num_files()) return 0;
if (m_file_priority.size() <= index) return 1;
return m_file_priority[index];