From 3be51a04f5c9a7186c5136f10a40609513178809 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Mon, 27 Dec 2004 21:07:01 +0000
Subject: [PATCH] if no image, do not print errors

---
 plugins/gtkgui/gtkgui.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 596a303756..0f7f97c0ee 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -124,11 +124,12 @@ class ImageCellRenderer(gtk.GenericCellRenderer):
 			pix = self.image.get_data('iter').get_pixbuf()
 		elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
 			pix = self.image.get_pixbuf()
-		if pix:
-			window.draw_pixbuf(widget.style.black_gc, pix, \
-				draw_rect.x-pix_rect.x, draw_rect.y-pix_rect.y, draw_rect.x, \
-				draw_rect.y+2, draw_rect.width, draw_rect.height, \
-            gtk.gdk.RGB_DITHER_NONE, 0, 0)
+		else:
+			return
+		window.draw_pixbuf(widget.style.black_gc, pix, \
+			draw_rect.x-pix_rect.x, draw_rect.y-pix_rect.y, draw_rect.x, \
+			draw_rect.y+2, draw_rect.width, draw_rect.height, \
+			gtk.gdk.RGB_DITHER_NONE, 0, 0)
 
 	def on_get_size(self, widget, cell_area):
 		if self.image.get_storage_type() == gtk.IMAGE_ANIMATION:
@@ -136,6 +137,8 @@ class ImageCellRenderer(gtk.GenericCellRenderer):
 			pix = animation.get_iter().get_pixbuf()
 		elif self.image.get_storage_type() == gtk.IMAGE_PIXBUF:
 			pix = self.image.get_pixbuf()
+		else:
+			return 0, 0, 0, 0
 		pixbuf_width  = pix.get_width()
 		pixbuf_height = pix.get_height()
 		calc_width  = self.get_property("xpad") * 2 + pixbuf_width
-- 
GitLab