From 04dfb5ec3cb9f5a1dac737b429919a3e82768aab Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Tue, 27 Aug 2013 16:45:37 -0700 Subject: [PATCH] Protecting against NPE with null country detector. bug:10514454 Change-Id: I316c47eddbe4929599866a3f9da9129d0056e3e2 --- telephony/java/android/telephony/PhoneNumberUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 3ae210636f84f..ab429fd4b7ae1 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1805,7 +1805,7 @@ public class PhoneNumberUtils String countryIso; CountryDetector detector = (CountryDetector) context.getSystemService( Context.COUNTRY_DETECTOR); - if (detector != null) { + if (detector != null && detector.detectCountry() != null) { countryIso = detector.detectCountry().getCountryIso(); } else { Locale locale = context.getResources().getConfiguration().locale;