diff --git a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java index 73ecba36..358b38de 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java @@ -173,7 +173,10 @@ public final class PreferenceUtil { case "only_wifi": final ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo(); + NetworkInfo netInfo = null; + if (connectivityManager != null) { + netInfo = connectivityManager.getActiveNetworkInfo(); + } return netInfo != null && netInfo.getType() == ConnectivityManager.TYPE_WIFI && netInfo .isConnectedOrConnecting(); case "never":