From fb81f966267bc7d2a2994a8cf2eecdea3f4aca23 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 29 May 2013 03:30:33 +0000 Subject: [PATCH] merge runtime-checks instead of asserts fix from RC_0_16 --- src/torrent.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index 68b64aa3d..d6fa464f8 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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];