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

Commit 670ceded authored by Tun Zheng's avatar Tun Zheng
Browse files

Fix group divider make chrome crash issue.

ListMenuItemView's group divider is only existed in
popup_menu_item_layout, but Chrome use list_menu_item_layout.
It will make NullPointerException and crash the chrome.
Fix it by check null before using the group divider.

Bug: 66987086
Test: Long click an image from webpage in chrome, click the "Download
image" item, and it works well.

Change-Id: Ie5f19194a968b4fff0126e1cf8bebda5344c8105
parent 60d54878
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -319,13 +319,15 @@ public class ListMenuItemView extends LinearLayout
    public void setGroupDividerEnabled(boolean groupDividerEnabled) {
        // If mHasListDivider is true, disabling the groupDivider.
        // Otherwise, checking enbling it according to groupDividerEnabled flag.
        if (mGroupDivider != null) {
            mGroupDivider.setVisibility(!mHasListDivider
                    && groupDividerEnabled ? View.VISIBLE : View.GONE);
        }
    }

    @Override
    public void adjustListItemSelectionBounds(Rect rect) {
        if (mGroupDivider.getVisibility() == View.VISIBLE) {
        if (mGroupDivider != null && mGroupDivider.getVisibility() == View.VISIBLE) {
            // groupDivider is a part of MenuItemListView.
            // If ListMenuItem with divider enabled is hovered/clicked, divider also gets selected.
            // Clipping the selector bounds from the top divider portion when divider is enabled,