Check if media player is null before accessing tracks (#7388)

This commit is contained in:
ByteHamster 2024-09-08 12:05:13 +02:00 committed by GitHub
parent c26bd7f879
commit ab4d05e7b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
}