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

Commit 05374aff authored by Katherine Kuan's avatar Katherine Kuan
Browse files

Fix NPE in ExternalRawContactEditorView

state.getPrimaryEntry(StructureName.CONTENT_ITEM_TYPE) is
returning null (which is possible based on the javadoc
of the method). Hence, we need to do a null check, and
display a default name string if it is null.

Bug: 5114827
Change-Id: If9dcf7f324e9c54b6723bb6d6b5d1fd78ac2efd3
parent 8e61edc6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -168,7 +168,8 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView

        // Name
        primary = state.getPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
        mName.setText(primary.getAsString(StructuredName.DISPLAY_NAME));
        mName.setText(primary != null ? primary.getAsString(StructuredName.DISPLAY_NAME) :
                mContext.getString(R.string.missing_name));

        if (type.readOnly) {
            mAccountContainer.setOnClickListener(new OnClickListener() {