[telepathy-mission-control/master] _mcd_account_get_avatar: don't segfault on NULL out-parameters

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jun 2 09:12:26 PDT 2009


---
 src/mcd-account.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mcd-account.c b/src/mcd-account.c
index 375a0a6..c8f2141 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -2316,10 +2316,15 @@ _mcd_account_get_avatar (McdAccount *account, GArray **avatar,
     McdAccountPrivate *priv = MCD_ACCOUNT_PRIV (account);
     gchar *filename;
 
-    *mime_type = g_key_file_get_string (priv->keyfile, priv->unique_name,
-					MC_ACCOUNTS_KEY_AVATAR_MIME, NULL);
+    if (mime_type != NULL)
+        *mime_type = g_key_file_get_string (priv->keyfile, priv->unique_name,
+                                            MC_ACCOUNTS_KEY_AVATAR_MIME, NULL);
+
+    if (avatar == NULL)
+        return;
+
+    *avatar = NULL;
 
-    if (avatar) *avatar = NULL;
     filename = _mcd_account_get_avatar_filename (account);
 
     if (filename && g_file_test (filename, G_FILE_TEST_EXISTS))
-- 
1.5.6.5




More information about the telepathy-commits mailing list