Fix division by 0

This commit is contained in:
Andrew Resch 2009-06-10 05:34:06 +00:00
parent 79746c5bc6
commit f2002f9077
1 changed files with 7 additions and 3 deletions

View File

@ -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