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

Commit ea70d8d0 authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Fix a crash happening on a context menu."

parents 1fa74491 2e7234ce
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -298,6 +298,13 @@ public class RootsFragment extends Fragment implements ItemDragListener.DragHost
    @Override
    public boolean onContextItemSelected(MenuItem item) {
        AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
        // There is a possibility that this is called from DirectoryFragment since
        // all fragments' onContextItemSelected gets called when any menu item is selected
        // This is to guard against it since DirectoryFragment's RecylerView does not have a
        // menuInfo
        if (adapterMenuInfo == null) {
            return false;
        }
        final RootItem rootItem = (RootItem) mAdapter.getItem(adapterMenuInfo.position);
        switch (item.getItemId()) {
            case R.id.menu_eject_root: