changeset 30542:c6577fa16795

Avoid a crash (null pointer dereference) in QQ if the server_time was not parsed correctly, I have no idea if this will make QQ work better but it can't be any worse. Refs #10560, https://bugzilla.redhat.com/show_bug.cgi?id=531959
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 28 May 2010 18:55:41 +0000
parents eec2900b0eee
children ee1af22b7242
files libpurple/protocols/qq/qq_base.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/qq/qq_base.c	Fri May 28 14:53:47 2010 +0000
+++ b/libpurple/protocols/qq/qq_base.c	Fri May 28 18:55:41 2010 +0000
@@ -588,9 +588,14 @@
 		inet_ntoa(qd->my_ip), qd->my_port);
 
 	tm_local = localtime(&server_time);
-	purple_debug_info("QQ", "Server time: %d-%d-%d, %d:%d:%d\n",
-			(1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
-			tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);
+
+	if (tm_local != NULL)
+		purple_debug_info("QQ", "Server time: %d-%d-%d, %d:%d:%d\n",
+				(1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
+				tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);
+	else
+		purple_debug_error("QQ", "Server time could not be parsed\n");
+
 	return TRUE;
 }