changeset 28303:9206aabf0251

jabber: Don't crash when disconnecting if there's been no response from the server. PurpleBOSHConnection.sid is only set after we've received a resposne from the server, so if we try to send a 'terminate' before we have a response, it will crash on Win32 (NULL printf), plus it's wrong anyway.
author Paul Aurich <paul@darkrain42.org>
date Mon, 28 Sep 2009 22:11:54 +0000
parents 67a97fca157c
children a501f14e6961
files libpurple/protocols/jabber/bosh.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/bosh.c	Mon Sep 28 18:11:28 2009 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Mon Sep 28 22:11:54 2009 +0000
@@ -401,7 +401,8 @@
 
 void jabber_bosh_connection_close(PurpleBOSHConnection *conn)
 {
-	jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL);
+	if (conn->state == BOSH_CONN_ONLINE)
+		jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL);
 }
 
 static gboolean jabber_bosh_connection_error_check(PurpleBOSHConnection *conn, xmlnode *node) {