From c1f977a2d10f917856d9300ce6cc108354b4bffd Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 9 Dec 2008 08:22:20 +0000 Subject: [PATCH] Fix division by zero error in get_ratio --- deluge/core/torrent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index a77a54a13..c0dab4ac9 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -420,8 +420,11 @@ class Torrent: downloaded = status.all_time_download # We use 'total_done' if the downloaded value is 0 - if downloaded == 0: + if downloaded == 0 and status.total_done > 0: downloaded = status.total_done + else: + # Return -1.0 to signify infinity + return -1.0 return float(status.all_time_upload) / float(downloaded)