Author: andar

Revision: 5368

Log:
        Fix division by 0

Diff:
Modified: trunk/deluge/plugins/blocklist/blocklist/core.py
===================================================================
--- trunk/deluge/plugins/blocklist/blocklist/core.py    2009-06-10 04:44:51 UTC 
(rev 5367)
+++ trunk/deluge/plugins/blocklist/blocklist/core.py    2009-06-10 05:34:06 UTC 
(rev 5368)
@@ -226,9 +226,13 @@
     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



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to