From 6b630c9fd29204cc69efd3a07827f06f6405975e Mon Sep 17 00:00:00 2001 From: Giorgos Retsinas Date: Mon, 3 Oct 2016 14:49:02 +0300 Subject: [PATCH] [GtkUI] Fix ZeroDivisionError in piecesbar While waiting for metadata for a magnet, self.__num_pieces is zero. --- deluge/ui/gtkui/piecesbar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deluge/ui/gtkui/piecesbar.py b/deluge/ui/gtkui/piecesbar.py index 0cb31c25f..1f9932ec9 100644 --- a/deluge/ui/gtkui/piecesbar.py +++ b/deluge/ui/gtkui/piecesbar.py @@ -73,12 +73,12 @@ class PiecesBar(gtk.DrawingArea): # Restrict Cairo to the exposed area; avoid extra work self.__roundcorners_clipping() - if not self.__pieces and self.__num_pieces is not None: + if self.__pieces: + self.__draw_pieces() + elif self.__num_pieces: # Special case. Completed torrents do not send any pieces in their # status. self.__draw_pieces_completed() - elif self.__pieces: - self.__draw_pieces() self.__draw_progress_overlay() self.__write_text()