mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
[tcp] Add missing null check in resolveDomain()
The method lookupHostAddress() returns null in case of an error, hence we need to test if the returned value is null prior adding the endpoint. Should fix the following NPE: java.lang.NullPointerException: at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration (XMPPTCPConnection.java:606) at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal (XMPPTCPConnection.java:846) at org.jivesoftware.smack.AbstractXMPPConnection.connect (AbstractXMPPConnection.java:530) at org.jivesoftware.smack.ReconnectionManager$2.run (ReconnectionManager.java:282) at java.lang.Thread.run (Thread.java:784) Reported-by: Eng ChongMeng <cmeng.gm@gmail.com>
This commit is contained in:
parent
59cf449799
commit
c4228e072b
1 changed files with 4 additions and 2 deletions
|
@ -192,9 +192,11 @@ public class RemoteXmppTcpConnectionEndpoints {
|
||||||
|
|
||||||
for (SRV srv : sortedSrvRecords) {
|
for (SRV srv : sortedSrvRecords) {
|
||||||
List<InetAddress> targetInetAddresses = dnsResolver.lookupHostAddress(srv.target, lookupFailures, dnssecMode);
|
List<InetAddress> targetInetAddresses = dnsResolver.lookupHostAddress(srv.target, lookupFailures, dnssecMode);
|
||||||
|
if (targetInetAddresses != null) {
|
||||||
SrvXmppRemoteConnectionEndpoint endpoint = new SrvXmppRemoteConnectionEndpoint(srv, targetInetAddresses);
|
SrvXmppRemoteConnectionEndpoint endpoint = new SrvXmppRemoteConnectionEndpoint(srv, targetInetAddresses);
|
||||||
endpoints.add(endpoint);
|
endpoints.add(endpoint);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("Could not resolve DNS SRV resource records for " + srvDomain + ". Consider adding those.");
|
LOGGER.info("Could not resolve DNS SRV resource records for " + srvDomain + ". Consider adding those.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue