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

Commit 9e8bf29b authored by jiezha2x's avatar jiezha2x Committed by Michael Bestas
Browse files

Check whether the contact exists when saving the contact



Step to reproduce it on Nexus 4 with 4.4.2:
1.Launch Gallery app-->Random select one picture-->"Set picture as"
  -->"Contact photo"-->Random tap one contact-->"Crop picture"-->
  "Just once"-->crop the picture-->press home key
2.Launch People app-->delete the contact which selected in step1-->
  press home key-->Launch Gallery app again-->"Save"

When I set a picture cropped for a contact, before doing the save
operation, I delete the contact, now go on doing the save operation,
because the contact does not exist, the RawContacts is null, so the
function createRawContactDeltaList occurs a crash.

Change-Id: Ie6d26ff188790937e16915e636e4b484cacb12a4
Signed-off-by: default avatarZhangjie <jiex.z.zhang@intel.com>
Signed-off-by: default avatarguojingx <guojingx.wu@intel.com>
parent 8845d3ce
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -206,6 +206,12 @@ public class AttachPhotoActivity extends ContactsActivity {
     */
    private void saveContact(Contact contact) {

        if (contact.getRawContacts() == null) {
            Log.w(TAG, "No raw contacts found for contact");
            finish();
            return;
        }

        // Obtain the raw-contact that we will save to.
        RawContactDeltaList deltaList = contact.createRawContactDeltaList();
        RawContactDelta raw = deltaList.getFirstWritableRawContact(this);