1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-25 01:07:52 +00:00

Prevent crash

This commit is contained in:
M66B 2016-03-31 09:55:14 +02:00
parent 9011324e73
commit da0ea8c95c

View file

@ -990,12 +990,13 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
while (nis.hasMoreElements()) {
NetworkInterface ni = nis.nextElement();
for (InterfaceAddress ia : ni.getInterfaceAddresses())
if (ia.getAddress() instanceof Inet4Address) {
IPUtil.CIDR local = new IPUtil.CIDR(ia.getAddress(), ia.getNetworkPrefixLength());
Log.i(TAG, "Excluding " + ni.getName() + " " + local);
listExclude.add(local);
}
if (nis != null)
for (InterfaceAddress ia : ni.getInterfaceAddresses())
if (ia.getAddress() instanceof Inet4Address) {
IPUtil.CIDR local = new IPUtil.CIDR(ia.getAddress(), ia.getNetworkPrefixLength());
Log.i(TAG, "Excluding " + ni.getName() + " " + local);
listExclude.add(local);
}
}
} catch (SocketException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));