fixed division by zero when loading an empty torrent

This commit is contained in:
Arvid Norberg 2009-01-19 10:05:48 +00:00
parent cc86f78aa5
commit f722731799
1 changed files with 2 additions and 0 deletions

View File

@ -4385,9 +4385,11 @@ namespace libtorrent
// if we haven't yet met the seed limits, set the seed_ratio_not_met
// flag. That will make this seed prioritized
// downloaded may be 0 if the torrent is 0-sized
size_type downloaded = (std::max)(m_total_downloaded, m_torrent_file->total_size());
if (seed_time < s.seed_time_limit
&& (seed_time > 1 && download_time / float(seed_time) < s.seed_time_ratio_limit)
&& downloaded > 0
&& m_total_uploaded / downloaded < s.share_ratio_limit)
ret |= seed_ratio_not_met;