From e3cc99f62fa17d0f046addada2ce1c62f9c4534b Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Thu, 19 Nov 2020 01:36:30 +0900 Subject: [PATCH] Check highlight list before accessing. Fixes https://github.com/austinhuang0131/barinsta/issues/295 --- .../java/awais/instagrabber/fragments/StoryViewerFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java index 5501f5b5..40f04fd3 100644 --- a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java @@ -484,7 +484,7 @@ public class StoryViewerFragment extends Fragment { if (isHighlight) { final HighlightsViewModel highlightsViewModel = (HighlightsViewModel) viewModel; final List models = highlightsViewModel.getList().getValue(); - if (models == null) return; + if (models == null || models.isEmpty() || currentFeedStoryIndex >= models.size()) return; final HighlightModel model = models.get(currentFeedStoryIndex); currentStoryMediaId = model.getId(); currentStoryUsername = model.getTitle();