mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Merge pull request #7565 from nextcloud/hardenConnectionCheck
getActiveNetwork might be null
This commit is contained in:
commit
dc0337476d
1 changed files with 5 additions and 1 deletions
|
@ -118,7 +118,11 @@ class ConnectivityServiceImpl implements ConnectivityService {
|
|||
NetworkCapabilities networkCapabilities = platformConnectivityManager.getNetworkCapabilities(
|
||||
platformConnectivityManager.getActiveNetwork());
|
||||
|
||||
isMetered = !networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED);
|
||||
if (networkCapabilities != null) {
|
||||
isMetered = !networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED);
|
||||
} else {
|
||||
isMetered = ConnectivityManagerCompat.isActiveNetworkMetered(platformConnectivityManager);
|
||||
}
|
||||
} else {
|
||||
isMetered = ConnectivityManagerCompat.isActiveNetworkMetered(platformConnectivityManager);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue