Prevent NPE

This commit is contained in:
Martin Fietz 2018-11-04 20:44:39 +01:00
parent d7ce8c57cc
commit 3ee412a560
1 changed files with 4 additions and 1 deletions

View File

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