Module: deluge
Branch: master
Commit: ce636ccd57f9e2e330f44429466bc6c1580d2d34

Author: Calum Lind <[email protected]>
Date:   Sun Feb  6 01:09:13 2011 +0000

Catch a possible DivByZero error when moving folders around in fileview tab

---

 deluge/ui/gtkui/files_tab.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py
index b985ff1..2bcb531 100644
--- a/deluge/ui/gtkui/files_tab.py
+++ b/deluge/ui/gtkui/files_tab.py
@@ -440,7 +440,11 @@ class FilesTab(Tab):
 
                 row = self.treestore.iter_next(row)
 
-            value = (float(bytes) / float(self.treestore[parent][1])) * 100
+            try:
+                value = (float(bytes) / float(self.treestore[parent][1])) * 100
+            except ZeroDivisionError:
+                # Catch the unusal error found when moving folders around
+                value = 0
             self.treestore[parent][3] = value
             self.treestore[parent][2] = "%.2f%%" % value
             return bytes

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