aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-22 21:11:22 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-22 21:14:21 +0800
commitf60338e75ad72300e1f93ea38ce17284d50d698c (patch)
tree301056ad0361ec7118285637a3cfc14a158324bc /libempathy
parent4c534b01f55b25442d8399db4a610a3e1982daa9 (diff)
downloadgsoc2013-empathy-f60338e75ad72300e1f93ea38ce17284d50d698c.tar
gsoc2013-empathy-f60338e75ad72300e1f93ea38ce17284d50d698c.tar.gz
gsoc2013-empathy-f60338e75ad72300e1f93ea38ce17284d50d698c.tar.bz2
gsoc2013-empathy-f60338e75ad72300e1f93ea38ce17284d50d698c.tar.lz
gsoc2013-empathy-f60338e75ad72300e1f93ea38ce17284d50d698c.tar.xz
gsoc2013-empathy-f60338e75ad72300e1f93ea38ce17284d50d698c.tar.zst
gsoc2013-empathy-f60338e75ad72300e1f93ea38ce17284d50d698c.zip
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
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact.c11
1 files changed, 10 insertions, 1 deletions
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);