From 0f752eb381b44182e048c39e621fba552c2179f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Thu, 29 Sep 2011 22:24:44 +0200
Subject: Work around FT crash when proxies are available.


diff --git a/Swiften/FileTransfer/DefaultLocalJingleTransportCandidateGenerator.cpp b/Swiften/FileTransfer/DefaultLocalJingleTransportCandidateGenerator.cpp
index 5b6da4c..4b205cb 100644
--- a/Swiften/FileTransfer/DefaultLocalJingleTransportCandidateGenerator.cpp
+++ b/Swiften/FileTransfer/DefaultLocalJingleTransportCandidateGenerator.cpp
@@ -67,13 +67,15 @@ void DefaultLocalJingleTransportCandidateGenerator::generateLocalTransportCandid
 		// get proxy candidates
 		std::vector<S5BProxyRequest::ref> proxyCandidates = s5bProxy->getS5BProxies();
 		foreach(S5BProxyRequest::ref proxy, proxyCandidates) {
-			JingleS5BTransportPayload::Candidate candidate;
-			candidate.type = JingleS5BTransportPayload::Candidate::ProxyType;
-			candidate.jid = proxy->getStreamHost().get().jid;
-			candidate.hostPort = proxy->getStreamHost().get().addressPort;
-			candidate.priority = 65536 * 10 + localPreference;
-			candidate.cid = idGenerator.generateID();
-			payL->addCandidate(candidate);
+			if (proxy->getStreamHost()) { // FIXME: Added this test, because there were cases where this wasn't initialized. Investigate this. (Remko)
+				JingleS5BTransportPayload::Candidate candidate;
+				candidate.type = JingleS5BTransportPayload::Candidate::ProxyType;
+				candidate.jid = (*proxy->getStreamHost()).jid;
+				candidate.hostPort = (*proxy->getStreamHost()).addressPort;
+				candidate.priority = 65536 * 10 + localPreference;
+				candidate.cid = idGenerator.generateID();
+				payL->addCandidate(candidate);
+			}
 		}
 
 		onLocalTransportCandidatesGenerated(payL);
-- 
cgit v0.10.2-6-g49f6