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

Commit 7983b8c1 authored by Jay Shrauner's avatar Jay Shrauner Committed by Natiq Ahmed
Browse files

Fix NPE in ContactSaveService

Check for null cursors before accessing.

Bug:18504067
Change-Id: I9945adfd45671d296ad64cd57aa4985a94d18144
parent 22937a21
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1099,6 +1099,9 @@ public class ContactSaveService extends IntentService {
        // Undemote the contact if necessary
        final Cursor c = getContentResolver().query(contactUri, new String[] {Contacts._ID},
                null, null, null);
        if (c == null) {
            return;
        }
        try {
            if (c.moveToFirst()) {
                final long id = c.getLong(0);
@@ -1301,6 +1304,11 @@ public class ContactSaveService extends IntentService {
                JoinContactQuery.PROJECTION,
                JoinContactQuery.SELECTION,
                new String[]{String.valueOf(contactId1), String.valueOf(contactId2)}, null);
        if (c == null) {
            Log.e(TAG, "Unable to open Contacts DB cursor");
            showToast(R.string.contactSavedErrorToast);
            return;
        }

        long rawContactIds[];
        long verifiedNameRawContactId = -1;