Merge pull request #2889 from AntennaPod/2882

Prevent NPE
This commit is contained in:
Martin Fietz 2018-11-11 10:06:22 +01:00 committed by GitHub
commit 816eb99e36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();
}