From 21d991ee8bab6e2ef7d9df0b268b39053b21cf5b Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Tue, 19 Nov 2013 09:43:56 -0800 Subject: Fix crash when number is null Fix crash in various routines when the number is null. Bug:11766758 Change-Id: I3bcedbd8ada663a8c47528f32e213f653195fe57 --- src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java index 32b49b336..2133f0f9d 100644 --- a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java +++ b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java @@ -50,7 +50,7 @@ public class PhoneNumberUtilsWrapper { * mock-out this, it is not a static method. */ public boolean isVoicemailNumber(CharSequence number) { - return PhoneNumberUtils.isVoiceMailNumber(number.toString()); + return number!= null && PhoneNumberUtils.isVoiceMailNumber(number.toString()); } /** @@ -58,7 +58,7 @@ public class PhoneNumberUtilsWrapper { * static method. */ public boolean isSipNumber(CharSequence number) { - return PhoneNumberUtils.isUriNumber(number.toString()); + return number != null && PhoneNumberUtils.isUriNumber(number.toString()); } public static boolean isUnknownNumberThatCanBeLookedUp(CharSequence number, int presentation) { @@ -77,13 +77,13 @@ public class PhoneNumberUtilsWrapper { if (new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) { return false; } - if (isLegacyUnknownNumbers(number.toString())) { + if (isLegacyUnknownNumbers(number)) { return false; } return true; } public static boolean isLegacyUnknownNumbers(CharSequence number) { - return LEGACY_UNKNOWN_NUMBERS.contains(number.toString()); + return number != null && LEGACY_UNKNOWN_NUMBERS.contains(number.toString()); } } -- cgit v1.2.3