diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/DefaultNetworkMonitor.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/DefaultNetworkMonitor.kt index 0cfb4035..b2803315 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/DefaultNetworkMonitor.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/DefaultNetworkMonitor.kt @@ -41,7 +41,11 @@ object DefaultNetworkMonitor : UpstreamMonitor() { if (currentNetwork != network) return val oldProperties = currentLinkProperties!! currentLinkProperties = properties - val ifname = properties.interfaceName!! + val ifname = properties.interfaceName + if (ifname == null) { + onLost(network) + return + } check(ifname == oldProperties.interfaceName) if (properties.dnsServers != oldProperties.dnsServers) callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/VpnMonitor.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/VpnMonitor.kt index e7f24b41..8f459e45 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/VpnMonitor.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/VpnMonitor.kt @@ -44,7 +44,11 @@ object VpnMonitor : UpstreamMonitor() { synchronized(this@VpnMonitor) { if (currentNetwork != network) return val oldProperties = available.put(network, properties)!! - val ifname = properties.interfaceName!! + val ifname = properties.interfaceName + if (ifname == null) { + onLost(network) + return + } check(ifname == oldProperties.interfaceName) if (properties.dnsServers != oldProperties.dnsServers) callbacks.forEach { it.onAvailable(ifname, properties.dnsServers) }