diff options
author | Martin Fietz <martin.fietz@gmail.com> | 2018-11-04 20:44:39 +0100 |
---|---|---|
committer | Martin Fietz <martin.fietz@gmail.com> | 2018-11-04 20:44:39 +0100 |
commit | 3ee412a560a9ede3cb3e2e6042af6fc8dbf1fe6a (patch) | |
tree | 34e92a21fcc2bcab456b39485b44cfbdaf187c8a /core/src/main/java | |
parent | d7ce8c57cc28474837f076587e968729c149dac1 (diff) | |
download | AntennaPod-3ee412a560a9ede3cb3e2e6042af6fc8dbf1fe6a.zip |
Prevent NPE
Diffstat (limited to 'core/src/main/java')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 041f1a809..68c9ac0ce 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -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(); } |