diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-05-28 01:53:35 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-05-28 01:53:35 +0800 |
commit | 2ad2fd6471f3374f09f76023f456bde1f0e5274d (patch) | |
tree | cbe3a7c47dcbbe8dd017f25bbdcec92f5549faf8 /libempathy/empathy-contact.c | |
parent | 891dd64e17fe816e6bab0b1e1d3ea35eb61a2e35 (diff) | |
download | gsoc2013-empathy-2ad2fd6471f3374f09f76023f456bde1f0e5274d.tar gsoc2013-empathy-2ad2fd6471f3374f09f76023f456bde1f0e5274d.tar.gz gsoc2013-empathy-2ad2fd6471f3374f09f76023f456bde1f0e5274d.tar.bz2 gsoc2013-empathy-2ad2fd6471f3374f09f76023f456bde1f0e5274d.tar.lz gsoc2013-empathy-2ad2fd6471f3374f09f76023f456bde1f0e5274d.tar.xz gsoc2013-empathy-2ad2fd6471f3374f09f76023f456bde1f0e5274d.tar.zst gsoc2013-empathy-2ad2fd6471f3374f09f76023f456bde1f0e5274d.zip |
Do not warning if we try to load the avatar of a contact that does not yet have its id.
svn path=/trunk/; revision=1129
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r-- | libempathy/empathy-contact.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 39d6148a2..e511144bf 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -769,6 +769,10 @@ contact_get_avatar_filename (EmpathyContact *contact, gchar *token_escaped; gchar *contact_escaped; + if (G_STR_EMPTY (priv->id)) { + return NULL; + } + contact_escaped = tp_escape_as_identifier (priv->id); token_escaped = tp_escape_as_identifier (token); @@ -796,13 +800,11 @@ empathy_contact_load_avatar_data (EmpathyContact *contact, const gchar *format, const gchar *token) { - EmpathyContactPriv *priv = GET_PRIV (contact); - EmpathyAvatar *avatar; - gchar *filename; - GError *error = NULL; + EmpathyAvatar *avatar; + gchar *filename; + GError *error = NULL; g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - g_return_if_fail (!G_STR_EMPTY (priv->id)); g_return_if_fail (data != NULL); g_return_if_fail (len > 0); g_return_if_fail (format != NULL); @@ -817,7 +819,7 @@ empathy_contact_load_avatar_data (EmpathyContact *contact, /* Save to cache if not yet in it */ filename = contact_get_avatar_filename (contact, token); - if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { + if (filename && !g_file_test (filename, G_FILE_TEST_EXISTS)) { if (!g_file_set_contents (filename, data, len, &error)) { DEBUG ("Failed to save avatar in cache: %s", error ? error->message : "No error given"); @@ -833,20 +835,18 @@ gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact, const gchar *token) { - EmpathyContactPriv *priv = GET_PRIV (contact); - EmpathyAvatar *avatar = NULL; - gchar *filename; - gchar *data = NULL; - gsize len; - GError *error = NULL; + EmpathyAvatar *avatar = NULL; + gchar *filename; + gchar *data = NULL; + gsize len; + GError *error = NULL; g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE); - g_return_val_if_fail (!G_STR_EMPTY (priv->id), FALSE); g_return_val_if_fail (!G_STR_EMPTY (token), FALSE); /* Load the avatar from file if it exists */ filename = contact_get_avatar_filename (contact, token); - if (g_file_test (filename, G_FILE_TEST_EXISTS)) { + if (filename && g_file_test (filename, G_FILE_TEST_EXISTS)) { if (!g_file_get_contents (filename, &data, &len, &error)) { DEBUG ("Failed to load avatar from cache: %s", error ? error->message : "No error given"); |