Allow mediaPlayer to be null

This commit is contained in:
ByteHamster 2018-09-26 17:32:39 +02:00
parent 819d2df8ed
commit 7dc5d9cfb1
1 changed files with 6 additions and 1 deletions

View File

@ -660,7 +660,12 @@ public class PlaybackService extends MediaBrowserServiceCompat {
private final PlaybackServiceMediaPlayer.PSMPCallback mediaPlayerCallback = new PlaybackServiceMediaPlayer.PSMPCallback() { private final PlaybackServiceMediaPlayer.PSMPCallback mediaPlayerCallback = new PlaybackServiceMediaPlayer.PSMPCallback() {
@Override @Override
public void statusChanged(PlaybackServiceMediaPlayer.PSMPInfo newInfo) { public void statusChanged(PlaybackServiceMediaPlayer.PSMPInfo newInfo) {
if (mediaPlayer != null) {
currentMediaType = mediaPlayer.getCurrentMediaType(); currentMediaType = mediaPlayer.getCurrentMediaType();
} else {
currentMediaType = MediaType.UNKNOWN;
}
updateMediaSession(newInfo.playerStatus); updateMediaSession(newInfo.playerStatus);
switch (newInfo.playerStatus) { switch (newInfo.playerStatus) {
case INITIALIZED: case INITIALIZED: