From 67e79250d222df9615732b40a79d17f2980d52e1 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sun, 4 Nov 2007 21:32:07 +0000 Subject: [PATCH] piece picker assert fix --- libtorrent/src/piece_picker.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libtorrent/src/piece_picker.cpp b/libtorrent/src/piece_picker.cpp index ebfe07637..831bd0986 100755 --- a/libtorrent/src/piece_picker.cpp +++ b/libtorrent/src/piece_picker.cpp @@ -962,16 +962,16 @@ namespace libtorrent int priority = p.priority(m_sequenced_download_threshold); TORRENT_ASSERT(priority < int(m_piece_info.size())); - TORRENT_ASSERT(p.downloading == 1); - TORRENT_ASSERT(!p.have()); - - std::vector::iterator i - = std::find_if(m_downloads.begin() - , m_downloads.end() - , has_index(index)); - TORRENT_ASSERT(i != m_downloads.end()); - erase_download_piece(i); - p.downloading = 0; + if (p.downloading) + { + std::vector::iterator i + = std::find_if(m_downloads.begin() + , m_downloads.end() + , has_index(index)); + TORRENT_ASSERT(i != m_downloads.end()); + erase_download_piece(i); + p.downloading = 0; + } TORRENT_ASSERT(std::find_if(m_downloads.begin(), m_downloads.end() , has_index(index)) == m_downloads.end());