0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-24 04:05:13 +00:00

Handle NetworkInfo being null

This commit is contained in:
Marvin W 2018-08-28 14:18:19 +02:00
parent f94d140dea
commit 7bbdcac990
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -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() {