From f60338e75ad72300e1f93ea38ce17284d50d698c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 22 Aug 2011 15:11:22 +0200 Subject: contact_set_avatar_from_tp_contact: don't crash if we failed to load the avatar https://bugzilla.gnome.org/show_bug.cgi?id=656829 --- libempathy/empathy-contact.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libempathy') diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index eac5a8b84..2058d4075 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -1811,8 +1811,17 @@ contact_set_avatar_from_tp_contact (EmpathyContact *contact) gchar *data; gsize len; gchar *path; + GError *error = NULL; + + if (!g_file_load_contents (file, NULL, &data, &len, NULL, &error)) + { + DEBUG ("Failed to load avatar: %s", error->message); + + g_error_free (error); + contact_set_avatar (contact, NULL); + return; + } - g_file_load_contents (file, NULL, &data, &len, NULL, NULL); path = g_file_get_path (file); avatar = empathy_avatar_new ((guchar *) data, len, mime, path); -- cgit v1.2.3