diff --git a/src/torrent.cpp b/src/torrent.cpp index 6682d0855..cc65ac8df 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -8101,6 +8101,8 @@ namespace libtorrent void torrent::file_progress(std::vector& fp) const { fp.clear(); + if (!valid_metadata()) return; + fp.resize(m_torrent_file->num_files(), 1.f); if (is_seed()) return; @@ -8117,7 +8119,11 @@ namespace libtorrent void torrent::file_progress(std::vector& fp, int flags) const { - TORRENT_ASSERT(valid_metadata()); + if (!valid_metadata()) + { + fp.clear(); + return; + } fp.resize(m_torrent_file->num_files(), 0);