fix crash when not on network

This commit is contained in:
Tony Tam 2022-01-02 00:39:19 -08:00
parent 15fe517476
commit 4f59b0248b
1 changed files with 2 additions and 1 deletions

View File

@ -103,7 +103,8 @@ public class NetworkUtils {
NetworkCapabilities capabilities = connManager.getNetworkCapabilities(
connManager.getActiveNetwork());
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
if (capabilities != null
&& capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
&& capabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) {
return false;
}