changeset 24543:c1f954e51389

Fix a crash that happens when accessing the roomlist for an account that's not connected. Fixes #7707. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Paul Aurich <paul@darkrain42.org>
date Sat, 06 Dec 2008 05:14:07 +0000
parents 2cae2b346d72
children 97af4329f786
files finch/gntroomlist.c libpurple/roomlist.c pidgin/gtkroomlist.c
diffstat 3 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntroomlist.c	Sat Dec 06 05:05:02 2008 +0000
+++ b/finch/gntroomlist.c	Sat Dec 06 05:14:07 2008 +0000
@@ -239,7 +239,8 @@
 		PurpleConnection *gc = list->data;
 
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
-		if (prpl_info->roomlist_get_list != NULL) {
+		if (PURPLE_CONNECTION_IS_CONNECTED(gc) &&
+		        prpl_info->roomlist_get_list != NULL) {
 			PurpleAccount *account = purple_connection_get_account(gc);
 			char *text = g_strdup_printf("%s (%s)",
 					purple_account_get_username(account),
--- a/libpurple/roomlist.c	Sat Dec 06 05:05:02 2008 +0000
+++ b/libpurple/roomlist.c	Sat Dec 06 05:14:07 2008 +0000
@@ -173,6 +173,7 @@
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
 	g_return_val_if_fail(gc != NULL, NULL);
+	g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL);
 
 	prpl = purple_connection_get_prpl(gc);
 
--- a/pidgin/gtkroomlist.c	Sat Dec 06 05:05:02 2008 +0000
+++ b/pidgin/gtkroomlist.c	Sat Dec 06 05:14:07 2008 +0000
@@ -488,7 +488,7 @@
 	PurpleConnection *conn = purple_account_get_connection(account);
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	if (conn)
+	if (conn && PURPLE_CONNECTION_IS_CONNECTED(conn))
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl);
 
 	return (prpl_info && prpl_info->roomlist_get_list != NULL);