From 7d72b9b770e0fc0dafb510081994a6b819b36d01 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 3 May 2014 11:17:51 +0200 Subject: [PATCH] Fix NPE in JavaxResolver Attributes.get(String) could return 'null'. Take care of that case. --- .../java/org/jivesoftware/smack/util/dns/JavaxResolver.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/JavaxResolver.java b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/JavaxResolver.java index 71a475f9c..3733ae21d 100644 --- a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/JavaxResolver.java +++ b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/JavaxResolver.java @@ -74,6 +74,8 @@ public class JavaxResolver implements DNSResolver { Attributes dnsLookup = dirContext.getAttributes(name, new String[] { "SRV" }); Attribute srvAttribute = dnsLookup.get("SRV"); + if (srvAttribute == null) + return res; @SuppressWarnings("unchecked") NamingEnumeration srvRecords = (NamingEnumeration) srvAttribute.getAll(); while (srvRecords.hasMore()) {