diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 3b1f32aa1..f8198ee7f 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -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