changeset 15030:b598a78c4550

[gaim-migrate @ 17813] Don't crash when getting info on someone on jabber with no resource name committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 22 Nov 2006 20:10:01 +0000
parents b4346a8b446f
children ea6186360b68
files libgaim/protocols/jabber/buddy.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/jabber/buddy.c	Wed Nov 22 18:47:42 2006 +0000
+++ b/libgaim/protocols/jabber/buddy.c	Wed Nov 22 20:10:01 2006 +0000
@@ -602,7 +602,7 @@
 	GString *info_text;
 	char *resource_name;
 	JabberBuddyResource *jbr;
-	JabberBuddyInfoResource *jbir;
+	JabberBuddyInfoResource *jbir = NULL;
 	GList *resources;
 
 	/* not yet */
@@ -650,8 +650,9 @@
 			jbr = resources->data;
 			if(jbr->status)
 				purdy = gaim_strdup_withhtml(jbr->status);
-			g_string_append_printf(info_text, "<b>%s:</b> %s<br/>",
-					_("Resource"), jbr->name);
+			if(jbr->name)
+				g_string_append_printf(info_text, "<b>%s:</b> %s<br/>",
+						_("Resource"), jbr->name);
 			g_string_append_printf(info_text, "<b>%s:</b> %d<br/>",
 					_("Priority"), jbr->priority);
 			g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/>",
@@ -661,7 +662,9 @@
 			if(purdy)
 				g_free(purdy);
 
-			jbir = g_hash_table_lookup(jbi->resources, jbr->name);
+			if(jbr->name)
+				jbir = g_hash_table_lookup(jbi->resources, jbr->name);
+
 			if(jbir) {
 				if(jbir->idle_seconds > 0) {
 					g_string_append_printf(info_text, "<b>%s:</b> %s<br/>",