Fix crash in item pager (#6542)

There should be no code path for feedItemPos to still be -1, but the
crash reports indicate that it does. So this is now the dirty fix to
avoid app crashes.
This commit is contained in:
ByteHamster 2023-07-15 22:04:11 +02:00 committed by GitHub
parent f1f3674230
commit fa12968ae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -70,7 +70,7 @@ public class ItemPagerFragment extends Fragment implements MaterialToolbar.OnMen
toolbar.setOnMenuItemClickListener(this); toolbar.setOnMenuItemClickListener(this);
feedItems = getArguments().getLongArray(ARG_FEEDITEMS); feedItems = getArguments().getLongArray(ARG_FEEDITEMS);
int feedItemPos = getArguments().getInt(ARG_FEEDITEM_POS); final int feedItemPos = Math.max(0, getArguments().getInt(ARG_FEEDITEM_POS));
pager = layout.findViewById(R.id.pager); pager = layout.findViewById(R.id.pager);
// FragmentStatePagerAdapter documentation: // FragmentStatePagerAdapter documentation: