Check if media player is null before accessing tracks (#7388)
This commit is contained in:
parent
c26bd7f879
commit
ab4d05e7b5
@ -31,6 +31,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -579,6 +580,9 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getAudioTracks() {
|
public List<String> getAudioTracks() {
|
||||||
|
if (mediaPlayer == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
return mediaPlayer.getAudioTracks();
|
return mediaPlayer.getAudioTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,6 +591,9 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectedAudioTrack() {
|
public int getSelectedAudioTrack() {
|
||||||
|
if (mediaPlayer == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return mediaPlayer.getSelectedAudioTrack();
|
return mediaPlayer.getSelectedAudioTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user