Prevent crash

pull/204/head
M66B 3 years ago
parent e6322b44f7
commit c9836f8006

@ -503,6 +503,7 @@ public class EmailService implements AutoCloseable {
boolean has4 = false; boolean has4 = false;
boolean has6 = false; boolean has6 = false;
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces != null && interfaces.hasMoreElements()) { while (interfaces != null && interfaces.hasMoreElements()) {
NetworkInterface ni = interfaces.nextElement(); NetworkInterface ni = interfaces.nextElement();
@ -517,6 +518,14 @@ public class EmailService implements AutoCloseable {
has6 = true; has6 = true;
} }
} }
} catch (Throwable ex2) {
Log.e(ex2);
/*
java.lang.NullPointerException: Attempt to read from field 'java.util.List java.net.NetworkInterface.childs' on a null object reference
at java.net.NetworkInterface.getAll(NetworkInterface.java:498)
at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:398)
*/
}
EntityLog.log(context, "Address main=" + main + EntityLog.log(context, "Address main=" + main +
" count=" + iaddrs.length + " count=" + iaddrs.length +

Loading…
Cancel
Save