Merge "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 2d9e9f5..bf79bfa 100644
--- a/src/com/android/contacts/activities/AttachPhotoActivity.java
+++ b/src/com/android/contacts/activities/AttachPhotoActivity.java
@@ -206,6 +206,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);