summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/filterednumber
diff options
context:
space:
mode:
authorBrandon Maxwell <maxwelb@google.com>2016-01-05 14:19:47 -0800
committerBrandon Maxwell <maxwelb@google.com>2016-01-05 15:34:04 -0800
commit45cbce1e6903e58bd585e3d9aaacf48bf637ea2e (patch)
treeeb205f3a8665e7fd7f85c4df31fc5a6b194e347d /src/com/android/dialer/filterednumber
parentfdb93b7079d522d688ec0ebe58c92d45aee48786 (diff)
Fixing NullPointer in NumbersAdapter
NumbersAdapater didn't properly handle null returns from ContactInfoHelper#lookupNumber(String, String), which is part of the method's documented contract. Bug=26337800 Change-Id: Ib974e83c22982ad4151fab564c91a61c112ca2ae
Diffstat (limited to 'src/com/android/dialer/filterednumber')
-rw-r--r--src/com/android/dialer/filterednumber/NumbersAdapter.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/com/android/dialer/filterednumber/NumbersAdapter.java b/src/com/android/dialer/filterednumber/NumbersAdapter.java
index 4e2e578a8..17d5db343 100644
--- a/src/com/android/dialer/filterednumber/NumbersAdapter.java
+++ b/src/com/android/dialer/filterednumber/NumbersAdapter.java
@@ -15,10 +15,8 @@
*/
package com.android.dialer.filterednumber;
-import android.app.Activity;
import android.app.FragmentManager;
import android.content.Context;
-import android.content.res.Resources;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.text.BidiFormatter;
@@ -43,7 +41,6 @@ public class NumbersAdapter extends SimpleCursorAdapter {
private Context mContext;
private FragmentManager mFragmentManager;
private ContactInfoHelper mContactInfoHelper;
- private Resources mResources;
private BidiFormatter mBidiFormatter = BidiFormatter.getInstance();
private ContactPhotoManager mContactPhotoManager;
@@ -68,11 +65,16 @@ public class NumbersAdapter extends SimpleCursorAdapter {
if (CompatUtils.hasPrioritizedMimeType()) {
quickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
}
- final ContactInfo info = mContactInfoHelper.lookupNumber(number, countryIso);
+
+ ContactInfo info = mContactInfoHelper.lookupNumber(number, countryIso);
+ if (info == null) {
+ info = new ContactInfo();
+ info.number = number;
+ }
final CharSequence locationOrType = getNumberTypeOrLocation(info);
final String displayNumber = getDisplayNumber(info);
- final String displayNumberStr = mBidiFormatter.unicodeWrap(
- displayNumber.toString(), TextDirectionHeuristics.LTR);
+ final String displayNumberStr = mBidiFormatter.unicodeWrap(displayNumber,
+ TextDirectionHeuristics.LTR);
String nameForDefaultImage;
if (!TextUtils.isEmpty(info.name)) {