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

Commit 1da57d88 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Check if menu item is null before adding assistant new badge

It crashes because there's no assistant in AOSP Contacts.

Bug: 32915307

Test: manual - verified that there's no crash in opening AOSP Contacts
               and that the new badge works well on GoogleContacts.

Change-Id: I3cc14da0c9e50fe0b2f4840645ded8c2563fbc65
parent b9065ddb
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -265,8 +265,12 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i
        if (mNavigationView == null) {
            return;
        }
        final LinearLayout newBadgeFrame = (LinearLayout) MenuItemCompat.getActionView(
                mNavigationView.getMenu().findItem(R.id.nav_assistant));
        final MenuItem assistantMenu = mNavigationView.getMenu().findItem(R.id.nav_assistant);
        if (assistantMenu == null) {
            return;
        }
        final LinearLayout newBadgeFrame =
                (LinearLayout) MenuItemCompat.getActionView(assistantMenu);
        final boolean showWelcomeBadge = !SharedPreferenceUtil.isWelcomeCardDismissed(this);
        if (showWelcomeBadge && newBadgeFrame.getChildCount() == 0) {
            if (mAssistantNewBadge == null) {