make torrent::have_piece support magnet links

This commit is contained in:
Arvid Norberg 2012-04-21 16:58:21 +00:00
parent 3cf7d0a7a2
commit a7f1d7df91
1 changed files with 3 additions and 1 deletions

View File

@ -500,7 +500,9 @@ namespace libtorrent
// returns true if we have downloaded the given piece
bool have_piece(int index) const
{
return has_picker()?m_picker->have_piece(index):true;
if (!valid_metadata()) return false;
if (!has_picker()) return true;
return m_picker->have_piece(index);
}
// called when we learn that we have a piece