From f722731799b51e6c35cca613795f61c54769be54 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 19 Jan 2009 10:05:48 +0000 Subject: [PATCH] fixed division by zero when loading an empty torrent --- src/torrent.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/torrent.cpp b/src/torrent.cpp index 69e0d3cd1..90bc87798 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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;