1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-24 13:02:06 +01:00

Fix NPE in JavaxResolver

Attributes.get(String) could return 'null'. Take care of that case.
This commit is contained in:
Florian Schmaus 2014-05-03 11:17:51 +02:00
parent 9484fb9259
commit 7d72b9b770

View file

@ -74,6 +74,8 @@ public class JavaxResolver implements DNSResolver {
Attributes dnsLookup = dirContext.getAttributes(name, new String[] { "SRV" }); Attributes dnsLookup = dirContext.getAttributes(name, new String[] { "SRV" });
Attribute srvAttribute = dnsLookup.get("SRV"); Attribute srvAttribute = dnsLookup.get("SRV");
if (srvAttribute == null)
return res;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
NamingEnumeration<String> srvRecords = (NamingEnumeration<String>) srvAttribute.getAll(); NamingEnumeration<String> srvRecords = (NamingEnumeration<String>) srvAttribute.getAll();
while (srvRecords.hasMore()) { while (srvRecords.hasMore()) {