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
This commit is contained in:
@@ -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.
|
||||
mGroupDivider.setVisibility(!mHasListDivider
|
||||
&& groupDividerEnabled ? View.VISIBLE : View.GONE);
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user