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

Commit 9e230619 authored by Walter Jang's avatar Walter Jang
Browse files

Guard against null listener when picking contacts

Bug 20841921

Change-Id: I6af688dc0e3ca7e1593824d5eb2f28f31fd897fc
parent 7590e66b
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ public class ContactPickerFragment extends ContactEntryListFragment<ContactEntry

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        if (position == 0 && mCreateContactEnabled) {
        if (position == 0 && mCreateContactEnabled && mListener != null) {
            mListener.onCreateNewContactAction();
        } else {
            super.onItemClick(parent, view, position, id);
@@ -142,16 +142,22 @@ public class ContactPickerFragment extends ContactEntryListFragment<ContactEntry
    }

    public void createNewContact() {
        if (mListener != null) {
            mListener.onCreateNewContactAction();
        }
    }

    public void editContact(Uri contactUri) {
        if (mListener != null) {
            mListener.onEditContactAction(contactUri);
        }
    }

    public void pickContact(Uri uri) {
        if (mListener != null) {
            mListener.onPickContactAction(uri);
        }
    }

    @Override
    protected ContactEntryListAdapter createListAdapter() {
@@ -190,11 +196,15 @@ public class ContactPickerFragment extends ContactEntryListFragment<ContactEntry

    @Override
    public void onShortcutIntentCreated(Uri uri, Intent shortcutIntent) {
        if (mListener != null) {
            mListener.onShortcutIntentCreated(shortcutIntent);
        }
    }

    @Override
    public void onPickerResult(Intent data) {
        if (mListener != null) {
            mListener.onPickContactAction(data.getData());
        }
    }
}