fix issue querying block size from torrent before metadata has been received

This commit is contained in:
arvidn 2018-03-04 12:39:30 +01:00 committed by Arvid Norberg
parent d8ebcc7f0c
commit 282c49d6b5
1 changed files with 1 additions and 1 deletions

View File

@ -846,7 +846,7 @@ namespace libtorrent {
int block_size() const
{
return m_torrent_file
return valid_metadata()
? (std::min)(m_torrent_file->piece_length(), default_block_size)
: default_block_size;
}