[gnome-contacts] Don't crash if avatar-default-symbolic was not found



commit 6602482a92ccd84159fc08e78661b508bf997650
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Jan 7 12:10:35 2013 +0100

    Don't crash if avatar-default-symbolic was not found

 src/contacts-contact.vala |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index d06d481..9564d5b 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -1022,9 +1022,11 @@ public class Contacts.Contact : GLib.Object  {
       int avatar_size = (int) (size * 0.3);
       var icon_info = IconTheme.get_default ().lookup_icon ("avatar-default-symbolic", avatar_size,
 							    IconLookupFlags.GENERIC_FALLBACK);
-      Gdk.cairo_set_source_pixbuf (cr, icon_info.load_icon (), (size - avatar_size) / 2, (size - avatar_size) / 2);
-      cr.rectangle ((size - avatar_size) / 2, (size - avatar_size) / 2, avatar_size, avatar_size);
-      cr.fill ();
+      if (icon_info != null) {
+	Gdk.cairo_set_source_pixbuf (cr, icon_info.load_icon (), (size - avatar_size) / 2, (size - avatar_size) / 2);
+	cr.rectangle ((size - avatar_size) / 2, (size - avatar_size) / 2, avatar_size, avatar_size);
+	cr.fill ();
+      }
       pixbuf = Gdk.pixbuf_get_from_surface (cst, 0, 0, size, size);
     } catch {
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]