From f2002f9077fb50b20e5e34e8de08204e831f51ec Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 10 Jun 2009 05:34:06 +0000 Subject: [PATCH] Fix division by 0 --- deluge/plugins/blocklist/blocklist/core.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deluge/plugins/blocklist/blocklist/core.py b/deluge/plugins/blocklist/blocklist/core.py index b298c032b..056c7ef55 100644 --- a/deluge/plugins/blocklist/blocklist/core.py +++ b/deluge/plugins/blocklist/blocklist/core.py @@ -226,9 +226,13 @@ class Core(CorePluginBase): def download_blocklist_thread(self, callback, load): """Downloads the blocklist specified by 'url' in the config""" def on_retrieve_data(count, block_size, total_blocks): - fp = float(count * block_size) / total_blocks - if fp > 1.0: - fp = 1.0 + if total_blocks: + fp = float(count * block_size) / total_blocks + if fp > 1.0: + fp = 1.0 + else: + fp = 0.0 + self.file_progress = fp import socket