Skip to content

Commit

Permalink
Add null condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenchickenlove committed Nov 22, 2024
1 parent 43212b6 commit 195033f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ public final class HAProxyConfig extends ProxyConfig {
}

HAProxyConfig(InetSocketAddress proxyAddress, InetSocketAddress sourceAddress) {
checkArgument(sourceAddress.getAddress().getClass() == proxyAddress.getAddress().getClass(),
"sourceAddress and proxyAddress should be the same type");
// If proxyAddress is unresolved, getAddress() will return null.
if (proxyAddress.getAddress() != null) {
checkArgument(sourceAddress.getAddress().getClass() == proxyAddress.getAddress().getClass(),
"sourceAddress and proxyAddress should be the same type");
}
this.proxyAddress = proxyAddress;
this.sourceAddress = sourceAddress;
}
Expand Down

0 comments on commit 195033f

Please sign in to comment.