changeset 18237:2a5c5d675789

Fix a crash when you have an IM window open on a jabber account and the account gets disconnected.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 23 Jun 2007 06:01:30 +0000
parents f5a03ebb054f
children 7684084830c6
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/presence.c
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sat Jun 23 05:33:42 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat Jun 23 06:01:30 2007 +0000
@@ -1116,9 +1116,11 @@
 
 char *jabber_status_text(PurpleBuddy *b)
 {
-	JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
-			FALSE);
 	char *ret = NULL;
+	JabberBuddy *jb = NULL;
+	
+	if (b->account->gc && b->account->gc->proto_data)
+		jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE);
 
 	if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) {
 		ret = g_strdup(_("Not Authorized"));
--- a/libpurple/protocols/jabber/presence.c	Sat Jun 23 05:33:42 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sat Jun 23 06:01:30 2007 +0000
@@ -515,7 +515,7 @@
 		buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
 				jid->node ? "@" : "", jid->domain);
 		if((b = purple_find_buddy(js->gc->account, buddy_name)) == NULL) {
-			purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%x)",
+			purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%x)\n",
 				buddy_name, purple_account_get_username(js->gc->account), js->gc->account);
 			jabber_id_free(jid);
 			g_free(avatar_hash);