telepathy-glib: BaseChannel: assert that the subclass sets TargetHandleType

Will Thompson wjt at kemper.freedesktop.org
Tue Jul 31 12:00:42 PDT 2012


Module: telepathy-glib
Branch: master
Commit: ae5de32be39b2dbb6df88033e74ac792ad4ace84
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=ae5de32be39b2dbb6df88033e74ac792ad4ace84

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Tue Jul 31 20:54:31 2012 +0200

BaseChannel: assert that the subclass sets TargetHandleType

If the subclass sets the channel's target handle, then it had better set
the target handle type in the klass. I got this wrong when porting Idle
to TpBaseChannel.

Fist-bumped-by: Jonny Lamb <jonny.lamb at collabora.co.uk>

---

 telepathy-glib/base-channel.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c
index aceb350..78fb6e0 100644
--- a/telepathy-glib/base-channel.c
+++ b/telepathy-glib/base-channel.c
@@ -686,6 +686,8 @@ tp_base_channel_get_property (GObject *object,
           TpHandleRepoIface *repo = tp_base_connection_get_handles (
               chan->priv->conn, klass->target_handle_type);
 
+          g_assert (klass->target_handle_type != TP_HANDLE_TYPE_NONE);
+          g_assert (repo != NULL);
           g_value_set_string (value, tp_handle_inspect (repo, chan->priv->target));
         }
       else
@@ -702,6 +704,7 @@ tp_base_channel_get_property (GObject *object,
           TpHandleRepoIface *repo = tp_base_connection_get_handles (
               chan->priv->conn, TP_HANDLE_TYPE_CONTACT);
 
+          g_assert (repo != NULL);
           g_assert (chan->priv->initiator != 0);
           g_value_set_string (value, tp_handle_inspect (repo, chan->priv->initiator));
         }



More information about the telepathy-commits mailing list