Ensure structured name exists when creating a new delta
When I was able to repro the NPE, the RawContactDelta had the five
entries that were ensured in createNewRawContactDelta. The only
likely cause is mIntentExtras is either null or empty so
nothing is copied over and the entries are empty.
Test:
Opened the editor for a single read-only contact a bunch of times.
Bug: 31874062
Change-Id: I7f47ff766457f3daf2099344661a3f5caf92388d
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 0542436..90aad4c 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -1249,6 +1249,7 @@
// Ensure we have some default fields (if the account type does not support a field,
// ensureKind will not add it, so it is safe to add e.g. Event)
+ RawContactModifier.ensureKindExists(result, accountType, StructuredName.CONTENT_ITEM_TYPE);
RawContactModifier.ensureKindExists(result, accountType, Phone.CONTENT_ITEM_TYPE);
RawContactModifier.ensureKindExists(result, accountType, Email.CONTENT_ITEM_TYPE);
RawContactModifier.ensureKindExists(result, accountType, Organization.CONTENT_ITEM_TYPE);