diff options
author | Jay Shrauner <shrauner@google.com> | 2015-01-09 13:44:47 -0800 |
---|---|---|
committer | Jay Shrauner <shrauner@google.com> | 2015-01-09 13:52:14 -0800 |
commit | c851081f30cba53163977ec3c02b1e6281d67f67 (patch) | |
tree | 539ba3e77c0c2d6cf55ffa338d84e3e6754c9408 | |
parent | 7f039d16ca461165eb20a184f48b924c8b699e37 (diff) |
Add null checks
Bug: 18959494
Change-Id: I6dca7a8696b3dc0d104cba974644e1c3a5179024
-rw-r--r-- | src/com/android/dialer/calllog/ContactInfoHelper.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java index 01749fc22..3a1144f25 100644 --- a/src/com/android/dialer/calllog/ContactInfoHelper.java +++ b/src/com/android/dialer/calllog/ContactInfoHelper.java @@ -64,6 +64,9 @@ public class ContactInfoHelper { * @param countryIso the country associated with this number */ public ContactInfo lookupNumber(String number, String countryIso) { + if (TextUtils.isEmpty(number)) { + return null; + } final ContactInfo info; // Determine the contact info. @@ -149,6 +152,9 @@ public class ContactInfoHelper { * value. */ private ContactInfo lookupContactFromUri(Uri uri) { + if (uri == null) { + return null; + } final ContactInfo info; Cursor phonesCursor = mContext.getContentResolver().query(uri, PhoneQuery._PROJECTION, null, null, null); @@ -193,6 +199,9 @@ public class ContactInfoHelper { * If the lookup fails for some other reason, it returns null. */ private ContactInfo queryContactInfoForSipAddress(String sipAddress) { + if (TextUtils.isEmpty(sipAddress)) { + return null; + } final ContactInfo info; // "contactNumber" is a SIP address, so use the PhoneLookup table with the SIP parameter. @@ -212,6 +221,9 @@ public class ContactInfoHelper { * If the lookup fails for some other reason, it returns null. */ private ContactInfo queryContactInfoForPhoneNumber(String number, String countryIso) { + if (TextUtils.isEmpty(number)) { + return null; + } String contactNumber = number; if (!TextUtils.isEmpty(countryIso)) { // Normalize the number: this is needed because the PhoneLookup query below does not |