Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aae114c1 authored by Jay Shrauner's avatar Jay Shrauner
Browse files

Fix NPE in lookupContactFromUri

Trap NPE thrown by pre-N CP2.

Bug:25941069
Change-Id: Id510e84e6e7e4a63a9b3267c183e23b73b0fabbc
parent b8ca208e
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -157,9 +157,14 @@ public class ContactInfoHelper {
            return ContactInfo.EMPTY;
        }

        Cursor phoneLookupCursor = mContext.getContentResolver().query(uri,
        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;
        }