am 1a576923: Merge "Check whether the contact exists when saving the contact"
* commit '1a576923d9eaa74f68076227949fdcfade5baa9c':
Check whether the contact exists when saving the contact
diff --git a/src/com/android/contacts/activities/AttachPhotoActivity.java b/src/com/android/contacts/activities/AttachPhotoActivity.java
index f70bc7e..25c23e0 100644
--- a/src/com/android/contacts/activities/AttachPhotoActivity.java
+++ b/src/com/android/contacts/activities/AttachPhotoActivity.java
@@ -207,6 +207,12 @@
*/
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);