diff options
author | Jay Shrauner <shrauner@google.com> | 2015-12-01 09:55:43 -0800 |
---|---|---|
committer | Jay Shrauner <shrauner@google.com> | 2015-12-01 10:03:26 -0800 |
commit | aae114c17fd97055522e7d8e77759cd09f869e8b (patch) | |
tree | d5b32659c31f38c205923bdf5513a6e0f62d72ea | |
parent | b8ca208e1856f682c4da630a6c19496f8e2620b0 (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.java | 11 |
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; } |