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

Commit 099046cf authored by Brian Attwell's avatar Brian Attwell
Browse files

Support editable 3p accounts without nicknames

Fix a theoretical crash case.

We shouldn't assume the nickname field always exists.
All standard writable accounts have nickname fields.
But, it is possible to create an 3p account type with
an xml edit specification that omits the nickname
(I don't know if anyone does this).

Bug: 18004959
Change-Id: I9770e88891e5800ef56d2df8a0ddb8463e3e8815
parent 7c801209
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -269,12 +269,18 @@ public class RawContactEditorView extends BaseRawContactEditorView {
                // as a part of StructuredName's fake KindSectionView, even though it uses a
                // different CP2 mime-type. We do a bit of extra work below to make this possible.
                final DataKind nickNameKind = type.getKindForMimetype(Nickname.CONTENT_ITEM_TYPE);
                if (nickNameKind != null) {
                    ValuesDelta primaryNickNameEntry = state.getPrimaryEntry(nickNameKind.mimeType);
                    if (primaryNickNameEntry == null) {
                        primaryNickNameEntry = RawContactModifier.insertChild(state, nickNameKind);
                    }
                    mNickName.setValues(nickNameKind, primaryNickNameEntry, state, false, vig);
                    mNickName.setDeletable(false);
                } else {
                    mPhoneticName.setPadding(0, 0, 0, (int) getResources().getDimension(
                            R.dimen.editor_padding_between_editor_views));
                    mNickName.setVisibility(View.GONE);
                }
            } else if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
                // Handle special case editor for photos
                final ValuesDelta primary = state.getPrimaryEntry(mimeType);