summaryrefslogtreecommitdiff
path: root/telepathy-glib/channel-contacts.c
diff options
context:
space:
mode:
Diffstat (limited to 'telepathy-glib/channel-contacts.c')
-rw-r--r--telepathy-glib/channel-contacts.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/telepathy-glib/channel-contacts.c b/telepathy-glib/channel-contacts.c
index 88f968f3c..011733363 100644
--- a/telepathy-glib/channel-contacts.c
+++ b/telepathy-glib/channel-contacts.c
@@ -108,6 +108,17 @@ dup_contacts_table (TpChannel *self,
return target;
}
+/* self->priv->group_contact_owners may contain NULL TpContact and
+ * g_object_unref isn't NULL safe */
+static void
+safe_g_object_unref (gpointer data)
+{
+ if (data == NULL)
+ return;
+
+ g_object_unref (data);
+}
+
static GHashTable *
dup_owners_table (TpChannel *self,
GHashTable *source,
@@ -117,7 +128,7 @@ dup_owners_table (TpChannel *self,
GHashTableIter iter;
gpointer key, value;
- target = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
+ target = g_hash_table_new_full (NULL, NULL, NULL, safe_g_object_unref);
g_hash_table_iter_init (&iter, source);
while (g_hash_table_iter_next (&iter, &key, &value))