Module: deluge
Branch: 1.3-stable
Commit: ca0003a7affbd47cd67c7ce39ae819d17fc1a379

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 af99c0c..75fa6d3 100644
--- a/deluge/ui/gtkui/files_tab.py
+++ b/deluge/ui/gtkui/files_tab.py
@@ -437,7 +437,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