From c851081f30cba53163977ec3c02b1e6281d67f67 Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Fri, 9 Jan 2015 13:44:47 -0800 Subject: Add null checks Bug: 18959494 Change-Id: I6dca7a8696b3dc0d104cba974644e1c3a5179024 --- src/com/android/dialer/calllog/ContactInfoHelper.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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 -- cgit v1.2.3