Don't crash trying to show item at negative position (#6407)

I have no idea what code path could pass a negative number there,
but apparently there are users who experience a crash when trying
to show a negative position.
This commit is contained in:
ByteHamster 2023-04-02 10:31:15 +02:00 committed by GitHub
parent 78f65349d5
commit b706ab9776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ public class ItemPagerFragment extends Fragment implements MaterialToolbar.OnMen
ItemPagerFragment fragment = new ItemPagerFragment(); ItemPagerFragment fragment = new ItemPagerFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLongArray(ARG_FEEDITEMS, feeditems); args.putLongArray(ARG_FEEDITEMS, feeditems);
args.putInt(ARG_FEEDITEM_POS, feedItemPos); args.putInt(ARG_FEEDITEM_POS, Math.max(0, feedItemPos));
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
} }