Add null check before copying name fields
Bail if either name value delta is null. This can happen because
external read only raw contacts may not have a StructuredName, such
as the ones created by the Signal app.
User facing consequence is the name isn't auto copied for them, but
without a StructuredName type declared by the read only raw contact
there isn't a reliable way to even get something to copy.
Test: Verified editing a Signal raw contact doesn't crash the app
and the editor loads with the same behavior as if a new contact was
being created.
Bug: 33622717
Change-Id: I87b513ca9f188750f0d5e4e5f5392e419565cf4e
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 8f8d10f..1a7a391 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -1222,8 +1222,11 @@
.getSuperPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
final ValuesDelta readNameDelta = readOnly
.getSuperPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
- writeNameDelta.copyStructuredNameFieldsFrom(readNameDelta);
mCopyReadOnlyName = false;
+ if (writeNameDelta == null || readNameDelta == null) {
+ return;
+ }
+ writeNameDelta.copyStructuredNameFieldsFrom(readNameDelta);
}
/**