Fixes a NullPointerException in the case of relayed candidates.

This commit is contained in:
lubomir.marinov 2010-06-29 09:45:27 +00:00
parent c859509daa
commit f57ba6870e

View File

@ -45,15 +45,23 @@ public class FoundationsRegistry
public void assignFoundation(Candidate candidate)
{
//create the foundation key String
String type = candidate.getType().toString();
CandidateType candidateType = candidate.getType();
String type = candidateType.toString();
String base
= candidate.getBase().getTransportAddress().getHostAddress();
String server = null;
String server;
if(candidate.getType() == CandidateType.SERVER_REFLEXIVE_CANDIDATE
|| candidate.getType() == CandidateType.RELAYED_CANDIDATE)
switch (candidateType)
{
case SERVER_REFLEXIVE_CANDIDATE:
server = candidate.getStunServerAddress().getHostAddress();
break;
case RELAYED_CANDIDATE:
server = candidate.getTurnServerAddress().getHostAddress();
break;
default:
server = null;
break;
}
String transport = candidate.getTransport().toString();