Fixes a (possible) NullPointerException.
This commit is contained in:
parent
50dd346aaf
commit
5e489a8f05
@ -296,30 +296,36 @@ public abstract class Candidate<T extends Candidate<?>>
|
|||||||
if (! (obj instanceof Candidate))
|
if (! (obj instanceof Candidate))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Candidate<?> targetCandidate = (Candidate<?>) obj;
|
Candidate<?> candidate = (Candidate<?>) obj;
|
||||||
|
|
||||||
//compare candidate addresses
|
//compare candidate addresses
|
||||||
if( ! targetCandidate.getTransportAddress()
|
if (! candidate.getTransportAddress().equals(getTransportAddress()))
|
||||||
.equals(getTransportAddress()))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//compare bases
|
//compare bases
|
||||||
if( getBase() == null )
|
Candidate<?> base = getBase();
|
||||||
|
Candidate<?> candidateBase = candidate.getBase();
|
||||||
|
boolean baseEqualsCandidateBase;
|
||||||
|
|
||||||
|
if (base == null)
|
||||||
{
|
{
|
||||||
if (targetCandidate.getBase() != null)
|
if (candidateBase != null)
|
||||||
return false;
|
return false;
|
||||||
|
else
|
||||||
|
baseEqualsCandidateBase = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
baseEqualsCandidateBase = base.equals(candidateBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
//compare other properties
|
//compare other properties
|
||||||
if(((getBase() == this && targetCandidate.getBase() == targetCandidate)
|
return
|
||||||
|| getBase().equals(targetCandidate.getBase()))
|
(baseEqualsCandidateBase
|
||||||
&& getPriority() == targetCandidate.getPriority()
|
|| (base == this && candidateBase == candidate))
|
||||||
&& getType() == targetCandidate.getType()
|
&& getPriority() == candidate.getPriority()
|
||||||
&& getFoundation().equals(targetCandidate.getFoundation()))
|
&& getType() == candidate.getType()
|
||||||
{
|
&& getFoundation().equals(candidate.getFoundation());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user