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

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

Fix NPE in ContactSaveService

Check for null cursors before accessing.

Bug:18504067
Change-Id: I9945adfd45671d296ad64cd57aa4985a94d18144
parent 29dfdb59
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -817,6 +817,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);
@@ -1005,6 +1008,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;