From 63e3a649a5a00aa0f36434f42aae8f68bc3a2394 Mon Sep 17 00:00:00 2001 From: Chandni Verma Date: Sat, 3 Aug 2013 20:43:01 +0530 Subject: Fix assertion failure on opening conversation menu in 1-1 chats --- src/empathy-chat-window.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index a906b24b8..b373b9c4e 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -1144,18 +1144,27 @@ chat_window_conv_activate_cb (GtkAction *action, else { TpChannel *channel = NULL; + TpContact *self_contact = NULL; 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); -- cgit v1.2.3