1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-17 14:20:21 +01:00

Merge pull request #1560 from kapodamy/wifi-check-fix

Additional checks to obtain WiFi status
This commit is contained in:
Mauricio Colli 2018-08-12 23:27:00 -03:00 committed by GitHub
commit d008d15167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -443,11 +443,11 @@ public final class ListHelper {
/**
* Are we connected to wifi?
* @param context App context
* @return True if connected to wifi
* @return {@code true} if connected to wifi
*/
private static boolean isWifiActive(Context context)
{
ConnectivityManager manager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
return manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
return manager != null && manager.getActiveNetworkInfo() != null && manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
}
}