Allow null interfaceName in onLinkPropertiesChanged
This commit is contained in:
@@ -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) }
|
||||
|
||||
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user