Prevent crash

This commit is contained in:
M66B 2017-04-16 13:17:14 +02:00
parent 3c7a91d3e0
commit 7d80aaf61d
1 changed files with 6 additions and 2 deletions

View File

@ -165,8 +165,12 @@ public class Util {
}
public static boolean isInternational(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return (tm != null && tm.getSimCountryIso() != null && !tm.getSimCountryIso().equals(tm.getNetworkCountryIso()));
try {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return (tm != null && tm.getSimCountryIso() != null && !tm.getSimCountryIso().equals(tm.getNetworkCountryIso()));
} catch (Throwable ignored) {
return false;
}
}
public static String getNetworkGeneration(int networkType) {