diff libpurple/protocols/oscar/oscar.c @ 18613:c5be17bbb6e4

Get rid of a crash that happens when signing off if you have a chat room open
author Mark Doliner <mark@kingant.net>
date Sun, 22 Jul 2007 08:54:03 +0000
parents 43a331f88c68
children 3f0204c58dfa 974f9298814c 4bd16a73769c
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Sun Jul 22 08:30:12 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Sun Jul 22 08:54:03 2007 +0000
@@ -1431,7 +1431,6 @@
 purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value)
 {
 	PurpleConnection *gc = user_data;
-	OscarData *od = gc->proto_data;
 
 	/* Disconnect */
 	gc->wants_to_die = TRUE;
@@ -3473,25 +3472,28 @@
 
 	if (conn->type == SNAC_FAMILY_CHAT) {
 		struct chat_connection *cc;
-		PurpleConversation *conv;
+		PurpleConversation *conv = NULL;
 
 		cc = find_oscar_chat_by_conn(gc, conn);
-		conv = purple_find_chat(gc, cc->id);
-
-		if (conv != NULL)
+		if (cc != NULL)
 		{
-			/*
-			 * TOOD: Have flap_connection_destroy_cb() send us the
-			 *       error message stored in 'tmp', which should be
-			 *       human-friendly, and print that to the chat room.
-			 */
-			gchar *buf;
-			buf = g_strdup_printf(_("You have been disconnected from chat "
-									"room %s."), cc->name);
-			purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL));
-			g_free(buf);
+			conv = purple_find_chat(gc, cc->id);
+
+			if (conv != NULL)
+			{
+				/*
+				 * TOOD: Have flap_connection_destroy_cb() send us the
+				 *       error message stored in 'tmp', which should be
+				 *       human-friendly, and print that to the chat room.
+				 */
+				gchar *buf;
+				buf = g_strdup_printf(_("You have been disconnected from chat "
+										"room %s."), cc->name);
+				purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL));
+				g_free(buf);
+			}
+			oscar_chat_kill(gc, cc);
 		}
-		oscar_chat_kill(gc, cc);
 	}
 
 	return 1;