]> git.0d.be Git - empathy.git/commitdiff
Fix assertion failure on opening conversation menu in 1-1 chats
authorChandni Verma <chandniverma2112@gmail.com>
Sat, 3 Aug 2013 15:13:01 +0000 (20:43 +0530)
committerChandni Verma <chandniverma2112@gmail.com>
Sat, 3 Aug 2013 15:13:49 +0000 (20:43 +0530)
src/empathy-chat-window.c

index a906b24b8051b96f3e071aee9bf9fc1822072236..b373b9c4e179ddc0ddc0d6b3446a6bc84ba729de 100644 (file)
@@ -1144,18 +1144,27 @@ chat_window_conv_activate_cb (GtkAction *action,
   else
     {
       TpChannel *channel = NULL;
   else
     {
       TpChannel *channel = NULL;
+      TpContact *self_contact = NULL;
       TpHandle  self_handle = 0;
 
       channel = (TpChannel *) (empathy_chat_get_tp_chat (
           self->priv->current_chat));
       TpHandle  self_handle = 0;
 
       channel = (TpChannel *) (empathy_chat_get_tp_chat (
           self->priv->current_chat));
-      self_handle = tp_contact_get_handle (tp_channel_group_get_self_contact (
-          channel));
-      /* There is sometimes a lag between the members-changed signal
-         emitted on tp-chat and invalidated signal being emitted on the channel.
-         Leave Chat menu-item should be sensitive only till our self-handle is
-         a part of channel-members */
-      gtk_action_set_visible (self->priv->menu_conv_leave_chat,
-          self_handle != 0);
+      self_contact = tp_channel_group_get_self_contact (channel);
+      if (self_contact == NULL)
+      {
+        /* The channel may not be a group */
+        gtk_action_set_visible (self->priv->menu_conv_leave_chat, FALSE);
+      }
+      else
+      {
+        self_handle = tp_contact_get_handle (self_contact);
+        /* There is sometimes a lag between the members-changed signal
+           emitted on tp-chat and invalidated signal being emitted on the channel.
+           Leave Chat menu-item should be sensitive only till our self-handle is
+           a part of channel-members */
+        gtk_action_set_visible (self->priv->menu_conv_leave_chat,
+            self_handle != 0);
+      }
 
       /* Join Chat is insensitive for a connected chat */
       gtk_action_set_visible (self->priv->menu_conv_join_chat, FALSE);
 
       /* Join Chat is insensitive for a connected chat */
       gtk_action_set_visible (self->priv->menu_conv_join_chat, FALSE);