From 07fecda4865674c3bfda0f38042f0edb01c70b76 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Mon, 8 Aug 2005 23:06:48 +0000 Subject: [PATCH] catch and pass on exception of pixbufloader --- src/tabbed_chat_window.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index abd761ebd..998457e11 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -192,19 +192,23 @@ class TabbedChatWindow(chat.Chat): pass if img_decoded: pixbufloader = gtk.gdk.PixbufLoader() - pixbufloader.write(img_decoded) - pixbuf = pixbufloader.get_pixbuf() - pixbufloader.close() - scaled_buf = pixbuf.scale_simple(52, 52, gtk.gdk.INTERP_HYPER) - x = None - if self.xmls.has_key(vcard['jid']): - x = self.xmls[vcard['jid']] - # it can be xmls[jid/resource] if it's a vcard from pm - elif self.xmls.has_key(vcard['jid'] + '/' + vcard['resource']): - x = self.xmls[vcard['jid'] + '/' + vcard['resource']] - image = x.get_widget('avatar_image') - image.set_from_pixbuf(scaled_buf) - image.show_all() + try: + pixbufloader.write(img_decoded) + pixbuf = pixbufloader.get_pixbuf() + pixbufloader.close() + + scaled_buf = pixbuf.scale_simple(52, 52, gtk.gdk.INTERP_HYPER) + x = None + if self.xmls.has_key(vcard['jid']): + x = self.xmls[vcard['jid']] + # it can be xmls[jid/resource] if it's a vcard from pm + elif self.xmls.has_key(vcard['jid'] + '/' + vcard['resource']): + x = self.xmls[vcard['jid'] + '/' + vcard['resource']] + image = x.get_widget('avatar_image') + image.set_from_pixbuf(scaled_buf) + image.show_all() + except gobject.GError: # we may get "unknown image format" + pass def set_state_image(self, jid): prio = 0