diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-09-08 12:05:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-08 12:05:13 +0200 |
commit | ab4d05e7b59f29fe7edc5e882cc4fdcd28dd2278 (patch) | |
tree | ab640b30a43f7f556f53b00d280f3d2c42d102a5 | |
parent | c26bd7f8796d3bf0a7fa5541cf93370376b07cec (diff) | |
download | AntennaPod-ab4d05e7b59f29fe7edc5e882cc4fdcd28dd2278.zip |
Check if media player is null before accessing tracks (#7388)
-rw-r--r-- | playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/LocalPSMP.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/LocalPSMP.java b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/LocalPSMP.java index e6f2668e6..c1d55c8e8 100644 --- a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/LocalPSMP.java +++ b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/LocalPSMP.java @@ -31,6 +31,7 @@ import org.greenrobot.eventbus.EventBus; import java.io.File; import java.io.IOException; +import java.util.Collections; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -579,6 +580,9 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { } public List<String> getAudioTracks() { + if (mediaPlayer == null) { + return Collections.emptyList(); + } return mediaPlayer.getAudioTracks(); } @@ -587,6 +591,9 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { } public int getSelectedAudioTrack() { + if (mediaPlayer == null) { + return -1; + } return mediaPlayer.getSelectedAudioTrack(); } |