Parameter checking

This commit is contained in:
ByteHamster 2019-12-12 09:45:36 +01:00
parent a99a41e3bb
commit 551971a2f7
1 changed files with 3 additions and 0 deletions

View File

@ -50,6 +50,9 @@ public class ItemPagerFragment extends Fragment {
* @return The ItemFragment instance
*/
public static ItemPagerFragment newInstance(long[] feeditems, int feedItemPos) {
if (feeditems.length <= feedItemPos) {
throw new IllegalArgumentException("Trying to show a feed item that is out of the list");
}
ItemPagerFragment fragment = new ItemPagerFragment();
Bundle args = new Bundle();
args.putLongArray(ARG_FEEDITEMS, feeditems);