diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-06 20:24:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-06 20:24:47 +0200 |
commit | e4bac5ea71d8dc9b3cc8608b85cb461a6097e40f (patch) | |
tree | b5abfc03b4de9066835f2b254068637e69417d67 | |
parent | 00d6df6261f1e95d2461c12db6a5b80841713c1f (diff) | |
download | AntennaPod-e4bac5ea71d8dc9b3cc8608b85cb461a6097e40f.zip |
Do not crash if an event comes in before the media is loaded (#7067)
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java | 2 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java index 8fea6e209..45838d845 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java @@ -127,7 +127,7 @@ public class ChaptersFragment extends AppCompatDialogFragment { } private int getCurrentChapter(Playable media) { - if (controller == null) { + if (controller == null || media == null) { return -1; } return Chapter.getAfterPosition(media.getChapters(), controller.getPosition()); diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java index 57794b410..073d5b0be 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java @@ -261,6 +261,9 @@ public class CoverFragment extends Fragment { @Subscribe(threadMode = ThreadMode.MAIN) public void onEventMainThread(PlaybackPositionEvent event) { + if (media == null) { + return; + } int newChapterIndex = Chapter.getAfterPosition(media.getChapters(), event.getPosition()); if (newChapterIndex > -1 && newChapterIndex != displayedChapterIndex) { refreshChapterData(newChapterIndex); |