diff options
author | Chandni Verma <chandniverma2112@gmail.com> | 2011-05-09 18:56:30 +0800 |
---|---|---|
committer | Chandni Verma <chandniverma2112@gmail.com> | 2011-05-11 17:38:31 +0800 |
commit | 0c9a992db9d0f8426264b097f0aa0cfaca860509 (patch) | |
tree | d18ddcc74da2f050de02a00e7464701ef2833f56 | |
parent | 5324df2fe08ece901d34271afc56ac41e5100fbf (diff) | |
download | gsoc2013-empathy-0c9a992db9d0f8426264b097f0aa0cfaca860509.tar gsoc2013-empathy-0c9a992db9d0f8426264b097f0aa0cfaca860509.tar.gz gsoc2013-empathy-0c9a992db9d0f8426264b097f0aa0cfaca860509.tar.bz2 gsoc2013-empathy-0c9a992db9d0f8426264b097f0aa0cfaca860509.tar.lz gsoc2013-empathy-0c9a992db9d0f8426264b097f0aa0cfaca860509.tar.xz gsoc2013-empathy-0c9a992db9d0f8426264b097f0aa0cfaca860509.tar.zst gsoc2013-empathy-0c9a992db9d0f8426264b097f0aa0cfaca860509.zip |
Leave chatroom only if tp_chat exists
-rw-r--r-- | src/empathy-chat-window.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index b7bb6c874..61a1c5d47 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -1487,17 +1487,23 @@ chat_window_command_part (EmpathyChat *chat, GStrv strv) { EmpathyChat *chat_to_be_parted; + EmpathyTpChat *tp_chat = NULL; if (strv[1] == NULL) { - empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat), ""); + /* No chatroom ID specified */ + tp_chat = empathy_chat_get_tp_chat (chat); + if (tp_chat) + empathy_tp_chat_leave (tp_chat, ""); return; } chat_to_be_parted = empathy_chat_window_find_chat ( empathy_chat_get_account (chat), strv[1]); if (chat_to_be_parted != NULL) { - empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat_to_be_parted), - strv[2]); + /* Found a chatroom matching the specified ID */ + tp_chat = empathy_chat_get_tp_chat (chat_to_be_parted); + if (tp_chat) + empathy_tp_chat_leave (tp_chat, strv[2]); } else { gchar *message; @@ -1510,7 +1516,9 @@ chat_window_command_part (EmpathyChat *chat, * MUC then the current chatroom should be parted and srtv[1] should * be treated as part of the optional part-message. */ message = g_strconcat (strv[1], " ", strv[2], NULL); - empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat), message); + tp_chat = empathy_chat_get_tp_chat (chat); + if (tp_chat) + empathy_tp_chat_leave (tp_chat, message); g_free (message); } |