Prevent NPE
This commit is contained in:
parent
d7ce8c57cc
commit
3ee412a560
|
@ -1096,7 +1096,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
} else {
|
||||
state = PlaybackStateCompat.STATE_NONE;
|
||||
}
|
||||
sessionState.setState(state, mediaPlayer.getPosition(), mediaPlayer.getPlaybackSpeed());
|
||||
sessionState.setState(state, getCurrentPosition(), getCurrentPlaybackSpeed());
|
||||
long capabilities = PlaybackStateCompat.ACTION_PLAY_PAUSE
|
||||
| PlaybackStateCompat.ACTION_REWIND
|
||||
| PlaybackStateCompat.ACTION_FAST_FORWARD
|
||||
|
@ -1636,6 +1636,9 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
}
|
||||
|
||||
public float getCurrentPlaybackSpeed() {
|
||||
if(mediaPlayer == null) {
|
||||
return 1.0f;
|
||||
}
|
||||
return mediaPlayer.getPlaybackSpeed();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue