From ce636ccd57f9e2e330f44429466bc6c1580d2d34 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 b985ff125..2bcb531fa 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