]> git.0d.be Git - empathy.git/commitdiff
Don't assume that 'subscribe' exists.
authorWill Thompson <will.thompson@collabora.co.uk>
Tue, 11 Aug 2009 17:02:51 +0000 (18:02 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Tue, 18 Aug 2009 17:03:39 +0000 (18:03 +0100)
This fixes bug #591468, which is a crash when you open a tab to a
contact from the user list in an IRC channel. Idle doesn't have a
'subscribe' list, so priv->subscribe is NULL, so this crashed. But if
you don't have a subscribe list, obviously you can't add the contact to
subscribe, so we can just guard this appropriately.

Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
libempathy/empathy-tp-contact-list.c

index 7c94bc756482a620b7457ece20144c306c9c0789..cb03a97b5971a458f0c7f9ed99856b13f582ad73 100644 (file)
@@ -1165,21 +1165,24 @@ tp_contact_list_get_flags (EmpathyContactList *list)
 {
        EmpathyTpContactListPriv *priv;
        EmpathyContactListFlags flags;
 {
        EmpathyTpContactListPriv *priv;
        EmpathyContactListFlags flags;
-       TpChannelGroupFlags group_flags;
 
        g_return_val_if_fail (EMPATHY_IS_TP_CONTACT_LIST (list), FALSE);
 
        priv = GET_PRIV (list);
        flags = priv->flags;
 
 
        g_return_val_if_fail (EMPATHY_IS_TP_CONTACT_LIST (list), FALSE);
 
        priv = GET_PRIV (list);
        flags = priv->flags;
 
-       group_flags = tp_channel_group_get_flags (priv->subscribe);
+       if (priv->subscribe != NULL) {
+               TpChannelGroupFlags group_flags;
 
 
-       if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_ADD) {
-               flags |= EMPATHY_CONTACT_LIST_CAN_ADD;
-       }
+               group_flags = tp_channel_group_get_flags (priv->subscribe);
+
+               if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_ADD) {
+                       flags |= EMPATHY_CONTACT_LIST_CAN_ADD;
+               }
 
 
-       if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_REMOVE) {
-               flags |= EMPATHY_CONTACT_LIST_CAN_REMOVE;
+               if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_REMOVE) {
+                       flags |= EMPATHY_CONTACT_LIST_CAN_REMOVE;
+               }
        }
 
        return flags;
        }
 
        return flags;