changeset 16945:84b7a625512e

Fix #755 - Crash on disconnection due to oscar offline messaging check invalid pointer deref.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 08 May 2007 15:08:23 +0000
parents fac61b64be1e
children 74957a0aa633
files libpurple/protocols/oscar/oscar.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Tue May 08 14:52:58 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Tue May 08 15:08:23 2007 +0000
@@ -6463,15 +6463,18 @@
 gboolean
 oscar_offline_message(const PurpleBuddy *buddy)
 {
-	OscarData *od;
+	OscarData *od = NULL;
 	PurpleAccount *account;
-	PurpleConnection *gc;
+	PurpleConnection *gc = NULL;
 
 	account = purple_buddy_get_account(buddy);
-	gc = purple_account_get_connection(account);
-	od = (OscarData *)gc->proto_data;
-
-	return (od->icq && aim_sn_is_icq(purple_account_get_username(account)));
+	if (account != NULL) {
+		gc = purple_account_get_connection(account);
+		if (gc != NULL)
+			od = (OscarData *)gc->proto_data;
+	}
+
+	return (od != NULL && od->icq && aim_sn_is_icq(purple_account_get_username(account)));
 }
 
 /* TODO: Find somewhere to put this instead of including it in a bunch of places.