From fa12968ae55385d277b80b27140daec0607f6d07 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 15 Jul 2023 22:04:11 +0200 Subject: 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. --- app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java index f2cd02cec..016f29e65 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java @@ -70,7 +70,7 @@ public class ItemPagerFragment extends Fragment implements MaterialToolbar.OnMen toolbar.setOnMenuItemClickListener(this); 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); // FragmentStatePagerAdapter documentation: -- cgit v1.2.3