Mercurial > pidgin
comparison libgaim/protocols/jabber/buddy.c @ 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 | f23506e8f812 |
children | bc440018e208 |
comparison
equal
deleted
inserted
replaced
15029:b4346a8b446f | 15030:b598a78c4550 |
---|---|
600 static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) | 600 static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) |
601 { | 601 { |
602 GString *info_text; | 602 GString *info_text; |
603 char *resource_name; | 603 char *resource_name; |
604 JabberBuddyResource *jbr; | 604 JabberBuddyResource *jbr; |
605 JabberBuddyInfoResource *jbir; | 605 JabberBuddyInfoResource *jbir = NULL; |
606 GList *resources; | 606 GList *resources; |
607 | 607 |
608 /* not yet */ | 608 /* not yet */ |
609 if(jbi->ids) | 609 if(jbi->ids) |
610 return; | 610 return; |
648 for(resources = jbi->jb->resources; resources; resources = resources->next) { | 648 for(resources = jbi->jb->resources; resources; resources = resources->next) { |
649 char *purdy = NULL; | 649 char *purdy = NULL; |
650 jbr = resources->data; | 650 jbr = resources->data; |
651 if(jbr->status) | 651 if(jbr->status) |
652 purdy = gaim_strdup_withhtml(jbr->status); | 652 purdy = gaim_strdup_withhtml(jbr->status); |
653 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", | 653 if(jbr->name) |
654 _("Resource"), jbr->name); | 654 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", |
655 _("Resource"), jbr->name); | |
655 g_string_append_printf(info_text, "<b>%s:</b> %d<br/>", | 656 g_string_append_printf(info_text, "<b>%s:</b> %d<br/>", |
656 _("Priority"), jbr->priority); | 657 _("Priority"), jbr->priority); |
657 g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/>", | 658 g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/>", |
658 _("Status"), jabber_buddy_state_get_name(jbr->state), | 659 _("Status"), jabber_buddy_state_get_name(jbr->state), |
659 purdy ? ": " : "", | 660 purdy ? ": " : "", |
660 purdy ? purdy : ""); | 661 purdy ? purdy : ""); |
661 if(purdy) | 662 if(purdy) |
662 g_free(purdy); | 663 g_free(purdy); |
663 | 664 |
664 jbir = g_hash_table_lookup(jbi->resources, jbr->name); | 665 if(jbr->name) |
666 jbir = g_hash_table_lookup(jbi->resources, jbr->name); | |
667 | |
665 if(jbir) { | 668 if(jbir) { |
666 if(jbir->idle_seconds > 0) { | 669 if(jbir->idle_seconds > 0) { |
667 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", | 670 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", |
668 _("Idle"), gaim_str_seconds_to_string(jbir->idle_seconds)); | 671 _("Idle"), gaim_str_seconds_to_string(jbir->idle_seconds)); |
669 } | 672 } |