[telepathy-mission-control/master] _mcd_channel_get_immutable_properties: debug if returning NULL

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 1 05:56:45 PDT 2009


Ideally, this method should eventually have "does not return NULL
unless caller is buggy" as an API guarantee. Until then, we can at
least be noisy about it.
---
 src/mcd-channel.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index b7dafb9..9ac5a01 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -869,11 +869,27 @@ mcd_channel_is_missed (McdChannel *channel)
 GHashTable *
 _mcd_channel_get_immutable_properties (McdChannel *channel)
 {
+    GHashTable *ret;
+
     g_return_val_if_fail (MCD_IS_CHANNEL (channel), NULL);
 
-    return channel->priv->tp_chan ?
-        tp_channel_borrow_immutable_properties (channel->priv->tp_chan) :
-            NULL;
+    if (channel->priv->tp_chan == NULL)
+    {
+        DEBUG ("Channel %p has no associated TpChannel", channel);
+        return NULL;
+    }
+
+    ret = tp_channel_borrow_immutable_properties (channel->priv->tp_chan);
+
+    if (ret == NULL)
+    {
+        DEBUG ("Channel %p TpChannel %s (%p) has no immutable properties yet",
+               channel, tp_proxy_get_object_path (channel->priv->tp_chan),
+               channel->priv->tp_chan);
+        return NULL;
+    }
+
+    return ret;
 }
 
 /*
-- 
1.5.6.5




More information about the telepathy-commits mailing list