summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-04-04 08:40:40 (GMT)
committerTobias Markmann <tm@ayena.de>2017-04-04 09:53:23 (GMT)
commitac40889c5466314dd22def238449352a2a4cc67e (patch)
tree628e0da53dc453078ff7fbd45d0364215bc1ddb4
parenteb84a2f12778572ca97bb7ff8749fd80e84b16d4 (diff)
downloadswift-ac40889c5466314dd22def238449352a2a4cc67e.zip
swift-ac40889c5466314dd22def238449352a2a4cc67e.tar.bz2
Add missing check for initialised pointer
Coverity raised this issue. Test-Information: All unit and integration tests, including the file-transfer tests, passed on macOS 10.12.4. Change-Id: I418358366478ad76e4eff4fb0a3559373931e111
-rw-r--r--Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp
index 09b664f..834a401 100644
--- a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp
+++ b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp
@@ -141,51 +141,51 @@ void LocalJingleTransportCandidateGenerator::emitOnLocalTransportCandidatesGener
std::vector<HostAddressPort> directCandidates = s5bServerManager->getHostAddressPorts();
for(auto&& addressPort : directCandidates) {
if (addressPort.getAddress().getRawAddress().is_v6() &&
addressPort.getAddress().getRawAddress().to_v6().is_link_local()) {
continue;
}
JingleS5BTransportPayload::Candidate candidate;
candidate.type = JingleS5BTransportPayload::Candidate::DirectType;
candidate.jid = ownJID;
candidate.hostPort = addressPort;
candidate.priority = 65536 * 126 + LOCAL_PREFERENCE;
candidate.cid = idGenerator->generateID();
candidates.push_back(candidate);
}
}
if (options_.isAssistedAllowed()) {
// get assissted candidates
std::vector<HostAddressPort> assisstedCandidates = s5bServerManager->getAssistedHostAddressPorts();
for (auto&& addressPort : assisstedCandidates) {
JingleS5BTransportPayload::Candidate candidate;
candidate.type = JingleS5BTransportPayload::Candidate::AssistedType;
candidate.jid = ownJID;
candidate.hostPort = addressPort;
candidate.priority = 65536 * 120 + LOCAL_PREFERENCE;
candidate.cid = idGenerator->generateID();
candidates.push_back(candidate);
}
}
- if (options_.isProxiedAllowed() && s5bProxy->getOrDiscoverS5BProxies().is_initialized()) {
+ if (options_.isProxiedAllowed() && s5bProxy && s5bProxy->getOrDiscoverS5BProxies().is_initialized()) {
for (auto&& proxy : s5bProxy->getOrDiscoverS5BProxies().get()) {
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;
auto address = HostAddress::fromString((*proxy->getStreamHost()).host);
if (address) {
candidate.hostPort = HostAddressPort(address.get(), (*proxy->getStreamHost()).port);
candidate.priority = 65536 * 10 + LOCAL_PREFERENCE;
candidate.cid = idGenerator->generateID();
candidates.push_back(candidate);
}
}
}
}
onLocalTransportCandidatesGenerated(candidates);
}
}