From 1209663595c6b402b38b8413f76634c5398149f2 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 15 Jul 2008 06:54:44 +0000 Subject: [PATCH] Fix possible division by zero crash --- 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 28d90f58d..26b09a8f1 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -371,7 +371,10 @@ class Torrent: file_progress = self.handle.file_progress() ret = [] for i,f in enumerate(self.files): - ret.append(float(file_progress[i]) / float(f["size"])) + try: + ret.append(float(file_progress[i]) / float(f["size"])) + except ZeroDivisionError: + ret.append(0.0) return ret