diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/GcmPrefs.java b/play-services-core/src/main/java/org/microg/gms/gcm/GcmPrefs.java index 5a3084f0..d0cc000f 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/GcmPrefs.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/GcmPrefs.java @@ -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() {