comparison libpurple/protocols/jabber/chat.c @ 28659:c42d5c23a9e8

jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261. Also add some assertions to jabber_chat_find so this doesn't cause a crash in the future.
author Paul Aurich <paul@darkrain42.org>
date Thu, 24 Sep 2009 16:58:31 +0000
parents c585572e80dd
children 724e77faee1a
comparison
equal deleted inserted replaced
28658:fa77b70c8ca6 28659:c42d5c23a9e8
97 JabberChat *jabber_chat_find(JabberStream *js, const char *room, 97 JabberChat *jabber_chat_find(JabberStream *js, const char *room,
98 const char *server) 98 const char *server)
99 { 99 {
100 JabberChat *chat = NULL; 100 JabberChat *chat = NULL;
101 101
102 g_return_val_if_fail(room != NULL, NULL);
103 g_return_val_if_fail(server != NULL, NULL);
104
102 if(NULL != js->chats) 105 if(NULL != js->chats)
103 { 106 {
104 char *room_jid = g_strdup_printf("%s@%s", room, server); 107 char *room_jid = g_strdup_printf("%s@%s", room, server);
105 108
106 chat = g_hash_table_lookup(js->chats, jabber_normalize(NULL, room_jid)); 109 chat = g_hash_table_lookup(js->chats, jabber_normalize(NULL, room_jid));