mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-27 21:53:00 +00:00
Handle NetworkInfo being null
This commit is contained in:
parent
f94d140dea
commit
7bbdcac990
1 changed files with 2 additions and 1 deletions
|
@ -100,6 +100,7 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
|
|||
}
|
||||
|
||||
public String getNetworkPrefForInfo(NetworkInfo info) {
|
||||
if (info == null) return PREF_NETWORK_OTHER;
|
||||
if (info.isRoaming()) return PREF_NETWORK_ROAMING;
|
||||
switch (info.getType()) {
|
||||
case ConnectivityManager.TYPE_MOBILE:
|
||||
|
@ -190,7 +191,7 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
|
|||
}
|
||||
|
||||
public boolean isEnabledFor(NetworkInfo info) {
|
||||
return isEnabled() && getHeartbeatMsFor(info) >= 0;
|
||||
return isEnabled() && info != null && getHeartbeatMsFor(info) >= 0;
|
||||
}
|
||||
|
||||
public boolean isGcmLogEnabled() {
|
||||
|
|
Loading…
Reference in a new issue