From 6faafc6e87831e5ab60213d210ed9b782071c5fb Mon Sep 17 00:00:00 2001 From: "g@localhost.localdomain" Date: Sat, 17 Jun 2006 21:27:53 +0200 Subject: [PATCH] Handle empty tree --- ui/char_matrix.py | 3 +++ ui/gtk/pysize_widget.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ui/char_matrix.py b/ui/char_matrix.py index 51aad09..dcd8c20 100644 --- a/ui/char_matrix.py +++ b/ui/char_matrix.py @@ -33,6 +33,9 @@ class CharMatrix: self._vertical_line(0, 0, height) self._vertical_line(width - 1, 0, height) + if not tree.root: + return + offset = 0 for child in tree.root.get_children(): self._draw_boxes(child, 0, offset) diff --git a/ui/gtk/pysize_widget.py b/ui/gtk/pysize_widget.py index 8cae5c9..d250a59 100644 --- a/ui/gtk/pysize_widget.py +++ b/ui/gtk/pysize_widget.py @@ -158,6 +158,8 @@ class PysizeWidget(gtk.DrawingArea): self.tree = pysize_tree(self.args[0], self.options.max_depth, 2*RADIUS /self.allocation.height) self.needs_tree = False + if not self.tree.root: + return context.set_line_width(LINE_WIDTH) offset = 0 for child in self.tree.root.get_children(): -- 2.11.4.GIT