[next] telepathy-glib: tpl_entity_new_from_tp_contact: allow any @type if contact is NULL

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Thu Feb 13 16:06:09 CET 2014


Module: telepathy-glib
Branch: next
Commit: 6c163252958885578a77ca3cc12aec10dd34e24a
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=6c163252958885578a77ca3cc12aec10dd34e24a

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Thu Feb 13 14:45:12 2014 +0100

tpl_entity_new_from_tp_contact: allow any @type if contact is NULL

---

 telepathy-logger/entity.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/telepathy-logger/entity.c b/telepathy-logger/entity.c
index 445ee77..538395e 100644
--- a/telepathy-logger/entity.c
+++ b/telepathy-logger/entity.c
@@ -289,16 +289,21 @@ tpl_entity_new_from_tp_contact (TpContact *contact,
     TpEntityType type)
 {
   g_return_val_if_fail (contact == NULL || TP_IS_CONTACT (contact), NULL);
-  g_return_val_if_fail (type == TP_ENTITY_TYPE_CONTACT || type == TP_ENTITY_TYPE_SELF,
-      NULL);
 
   if (contact != NULL)
-    return tpl_entity_new (tp_contact_get_identifier (contact),
-        type,
-        tp_contact_get_alias (contact),
-        tp_contact_get_avatar_token (contact));
+    {
+      g_return_val_if_fail (type == TP_ENTITY_TYPE_CONTACT ||
+          type == TP_ENTITY_TYPE_SELF, NULL);
+
+      return tpl_entity_new (tp_contact_get_identifier (contact),
+          type,
+          tp_contact_get_alias (contact),
+          tp_contact_get_avatar_token (contact));
+    }
   else
-    return tpl_entity_new ("unknown", TP_ENTITY_TYPE_NONE, NULL, NULL);
+    {
+      return tpl_entity_new ("unknown", TP_ENTITY_TYPE_NONE, NULL, NULL);
+    }
 }
 
 



More information about the telepathy-commits mailing list