diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b6f8f0372..120811e626 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Line wrap the file at 100 chars. Th #### Android - Fix notification message to update to `null` version when version check cache is stale right after an update. +- Fix `null` pointer exception when connectivity event intent has no network info. ### Security #### Linux diff --git a/android/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt b/android/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt index 44f511f22a..c0edbfd021 100644 --- a/android/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt +++ b/android/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt @@ -42,7 +42,9 @@ class ConnectivityListener : BroadcastReceiver() { val networkInfo = intent.getParcelableExtra<NetworkInfo>(ConnectivityManager.EXTRA_NETWORK_INFO) - if (networkInfo.type != ConnectivityManager.TYPE_VPN) { + if (networkInfo == null) { + checkConnectionState(context) + } else if (networkInfo.type != ConnectivityManager.TYPE_VPN) { if (networkInfo.detailedState == DetailedState.DISCONNECTED) { checkConnectionState(context) } else if (networkInfo.detailedState == DetailedState.CONNECTED) { @@ -57,6 +59,7 @@ class ConnectivityListener : BroadcastReceiver() { isConnected = connectivityManager.allNetworks .map({ network -> connectivityManager.getNetworkInfo(network) }) + .filterNotNull() .any({ networkInfo -> networkInfo.type != ConnectivityManager.TYPE_VPN && networkInfo.detailedState == DetailedState.CONNECTED |
