changeset 19409:b8cbc7659a5a

Fix crashing when the sametime account disconnects and we update the conv. window infopanel. Fixes #2762.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 24 Aug 2007 21:25:30 +0000
parents cc36a5aac908
children 1096aea98217
files libpurple/protocols/sametime/sametime.c
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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);