From ca0003a7affbd47cd67c7ce39ae819d17fc1a379 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 6 Feb 2011 01:09:13 +0000 Subject: [PATCH] Catch a possible DivByZero error when moving folders around in fileview tab --- deluge/ui/gtkui/files_tab.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index af99c0c2b..75fa6d3f1 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