diff libpurple/protocols/jabber/jingle/iceudp.c @ 26128:20c16e29f364

Stop crash when there are no candidates set.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 25 Feb 2009 09:20:20 +0000
parents dfb6fbd89ac2
children 26cf297796a5
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/iceudp.c	Wed Feb 25 08:18:17 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/iceudp.c	Wed Feb 25 09:20:20 2009 +0000
@@ -334,10 +334,14 @@
 
 	if (action == JINGLE_SESSION_INITIATE || action == JINGLE_TRANSPORT_INFO ||
 			action == JINGLE_CONTENT_ADD || action == JINGLE_TRANSPORT_REPLACE) {
-		JingleIceUdpCandidate *candidate = JINGLE_ICEUDP_GET_PRIVATE(
-				transport)->local_candidates->data;
-		xmlnode_set_attrib(node, "pwd", candidate->password);
-		xmlnode_set_attrib(node, "ufrag", candidate->username);
+		JingleIceUdpPrivate *icetransport =
+				JINGLE_ICEUDP_GET_PRIVATE(transport);
+		if (icetransport && icetransport->local_candidates) {
+			JingleIceUdpCandidate *candidate =
+					icetransport->local_candidates->data;
+			xmlnode_set_attrib(node, "pwd", candidate->password);
+			xmlnode_set_attrib(node, "ufrag", candidate->username);
+		}
 	}
 
 	if (action == JINGLE_TRANSPORT_INFO || action == JINGLE_SESSION_ACCEPT) {