catch some more NPE in Resolver.java
This commit is contained in:
parent
2d5a7e013a
commit
e96467e5ad
1 changed files with 6 additions and 1 deletions
|
@ -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{" +
|
||||
|
|
Reference in a new issue