diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-02-08 18:38:19 +0100 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-02-08 18:38:19 +0100 |
commit | e96467e5ad9e001086be19cb6521c0f59ab8fd64 (patch) | |
tree | 58d211a739001824b4fc40dac201704600b4a9a6 /src/main/java/de/pixart/messenger | |
parent | 2d5a7e013a1c88616cca89ac4ac5ab2190971ef3 (diff) |
catch some more NPE in Resolver.java
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/Resolver.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/Resolver.java b/src/main/java/de/pixart/messenger/utils/Resolver.java index 86bdc40aa..4eb42db7e 100644 --- a/src/main/java/de/pixart/messenger/utils/Resolver.java +++ b/src/main/java/de/pixart/messenger/utils/Resolver.java @@ -6,6 +6,8 @@ import android.util.Log; import androidx.annotation.NonNull; +import org.jetbrains.annotations.NotNull; + import java.io.IOException; import java.lang.reflect.Field; import java.net.InetAddress; @@ -65,7 +67,9 @@ public class Resolver { final Field dnsClientField = ReliableDNSClient.class.getDeclaredField("dnsClient"); dnsClientField.setAccessible(true); final DNSClient dnsClient = (DNSClient) dnsClientField.get(reliableDNSClient); - dnsClient.getDataSource().setTimeout(3000); + if (dnsClient != null) { + dnsClient.getDataSource().setTimeout(3000); + } final Field useHardcodedDnsServers = DNSClient.class.getDeclaredField("useHardcodedDnsServers"); useHardcodedDnsServers.setAccessible(true); useHardcodedDnsServers.setBoolean(dnsClient, false); @@ -382,6 +386,7 @@ public class Resolver { return socket; } + @NotNull @Override public String toString() { return "Result{" + |