summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2015-12-01 09:55:43 -0800
committerJay Shrauner <shrauner@google.com>2015-12-01 10:03:26 -0800
commitaae114c17fd97055522e7d8e77759cd09f869e8b (patch)
treed5b32659c31f38c205923bdf5513a6e0f62d72ea
parentb8ca208e1856f682c4da630a6c19496f8e2620b0 (diff)
Fix NPE in lookupContactFromUri
Trap NPE thrown by pre-N CP2. Bug:25941069 Change-Id: Id510e84e6e7e4a63a9b3267c183e23b73b0fabbc
-rw-r--r--src/com/android/dialer/calllog/ContactInfoHelper.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 52d143784..5b6c52b64 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -157,9 +157,14 @@ public class ContactInfoHelper {
return ContactInfo.EMPTY;
}
- Cursor phoneLookupCursor = mContext.getContentResolver().query(uri,
- PhoneQuery.PHONE_LOOKUP_PROJECTION, null, null, null);
-
+ Cursor phoneLookupCursor = null;
+ try {
+ phoneLookupCursor = mContext.getContentResolver().query(uri,
+ PhoneQuery.PHONE_LOOKUP_PROJECTION, null, null, null);
+ } catch (NullPointerException e) {
+ // Trap NPE from pre-N CP2
+ return null;
+ }
if (phoneLookupCursor == null) {
return null;
}