# HG changeset patch # User Daniel Atallah # Date 1187990730 0 # Node ID b8cbc7659a5aaea57118ce7001173d83033f7504 # Parent cc36a5aac908d45a2f4a44a580a43ecb3f049143 Fix crashing when the sametime account disconnects and we update the conv. window infopanel. Fixes #2762. diff -r cc36a5aac908 -r b8cbc7659a5a libpurple/protocols/sametime/sametime.c --- a/libpurple/protocols/sametime/sametime.c Fri Aug 24 19:43:41 2007 +0000 +++ b/libpurple/protocols/sametime/sametime.c Fri Aug 24 21:25:30 2007 +0000 @@ -3183,13 +3183,12 @@ PurpleConnection *gc; struct mwPurplePluginData *pd; struct mwAwareIdBlock t = { mwAware_USER, b->name, NULL }; - const char *ret; - - gc = b->account->gc; - pd = gc->proto_data; - - ret = mwServiceAware_getText(pd->srvc_aware, &t); - + const char *ret = NULL; + + if ((gc = purple_account_get_connection(b->account)) + && (pd = gc->proto_data)) + ret = mwServiceAware_getText(pd->srvc_aware, &t); + return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL; } @@ -3242,17 +3241,17 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { PurpleConnection *gc; - struct mwPurplePluginData *pd; + struct mwPurplePluginData *pd = NULL; struct mwAwareIdBlock idb = { mwAware_USER, b->name, NULL }; - const char *message; + const char *message = NULL; const char *status; char *tmp; - gc = b->account->gc; - pd = gc->proto_data; - - message = mwServiceAware_getText(pd->srvc_aware, &idb); + if ((gc = purple_account_get_connection(b->account)) + && (pd = gc->proto_data)) + message = mwServiceAware_getText(pd->srvc_aware, &idb); + status = status_text(b); if(message != NULL && g_utf8_validate(message, -1, NULL) && purple_utf8_strcasecmp(status, message)) { @@ -3264,7 +3263,7 @@ purple_notify_user_info_add_pair(user_info, _("Status"), status); } - if(full) { + if(full && pd != NULL) { tmp = user_supports_text(pd->srvc_aware, b->name); if(tmp) { purple_notify_user_info_add_pair(user_info, _("Supports"), tmp);