[Telepathy-commits] [telepathy-gabble/master] GabbleIMChannel: assert that there is an initiator

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 19 10:53:52 PDT 2008


20080722135957-53eee-958fee9db2f254d7ced64a3459d369465d0ca5f3.gz
---
 src/im-channel.c |    6 ++++--
 src/im-factory.c |    4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/im-channel.c b/src/im-channel.c
index 9347f87..d5b96f1 100644
--- a/src/im-channel.c
+++ b/src/im-channel.c
@@ -125,8 +125,8 @@ gabble_im_channel_constructor (GType type, guint n_props,
 
   tp_handle_ref (contact_handles, priv->handle);
 
-  if (priv->initiator != 0)
-    tp_handle_ref (contact_handles, priv->initiator);
+  g_assert (priv->initiator != 0);
+  tp_handle_ref (contact_handles, priv->initiator);
 
   priv->peer_jid = g_strdup (tp_handle_inspect (contact_handles,
         priv->handle));
@@ -182,6 +182,7 @@ gabble_im_channel_get_property (GObject    *object,
           TpHandleRepoIface *repo = tp_base_connection_get_handles (
               (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
 
+          g_assert (priv->initiator != 0);
           g_value_set_string (value,
               tp_handle_inspect (repo, priv->initiator));
         }
@@ -229,6 +230,7 @@ gabble_im_channel_set_property (GObject     *object,
     case PROP_INITIATOR_HANDLE:
       /* similarly we can't ref this yet */
       priv->initiator = g_value_get_uint (value);
+      g_assert (priv->initiator != 0);
       break;
     case PROP_HANDLE_TYPE:
     case PROP_CHANNEL_TYPE:
diff --git a/src/im-factory.c b/src/im-factory.c
index 9f384f6..fda84da 100644
--- a/src/im-factory.c
+++ b/src/im-factory.c
@@ -321,7 +321,9 @@ new_im_channel (GabbleImFactory *fac,
   GabbleIMChannel *chan;
   char *object_path;
 
-  g_assert (GABBLE_IS_IM_FACTORY (fac));
+  g_return_val_if_fail (GABBLE_IS_IM_FACTORY (fac), NULL);
+  g_return_val_if_fail (handle != 0, NULL);
+  g_return_val_if_fail (initiator != 0, NULL);
 
   priv = GABBLE_IM_FACTORY_GET_PRIVATE (fac);
   conn = (TpBaseConnection *) priv->conn;
-- 
1.5.6.3




More information about the Telepathy-commits mailing list