From 0ec6af03c0ca4281ded946ef05eea2d50b63394a Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 29 Jun 2007 15:37:59 +0000 Subject: [PATCH] Fixed possible division by 0 --- src/bittorrent.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 669bfb4f1..4c0ea64f6 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -84,8 +84,10 @@ void bittorrent::updateETAs(){ }else{ torrent_status torrentStatus = h.status(); torrent_info ti = h.get_torrent_info(); - listEtas << (long)((ti.total_size()-torrentStatus.total_done)/(double)torrentStatus.download_payload_rate); - ETAstats[hash] = listEtas; + if(torrentStatus.download_payload_rate != 0){ + listEtas << (long)((ti.total_size()-torrentStatus.total_done)/(double)torrentStatus.download_payload_rate); + ETAstats[hash] = listEtas; + } } } }