diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2018-09-27 13:53:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-27 13:53:41 +0200 |
commit | 0ca7fc60b2eae628331017508537c4e7f5c57b59 (patch) | |
tree | 267f0067b4d2e6194de19ffc3076d28550e82843 /core | |
parent | c7ec2f26c62ada1a95a2b1ef12eda2f4e71bebc9 (diff) | |
parent | 33674625b47ac402e93311f481d7a0204c4cb4c4 (diff) | |
download | AntennaPod-0ca7fc60b2eae628331017508537c4e7f5c57b59.zip |
Merge pull request #2832 from ByteHamster/null-media-player
Do not crash if mediaPlayer is null
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java | 4 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java index 4f0da82fb..d2214cac8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java @@ -44,8 +44,8 @@ public class PlayerWidgetJobService extends JobIntentService { return; } - if (PlaybackService.isRunning && playbackService == null) { - synchronized (waitForService) { + synchronized (waitForService) { + if (PlaybackService.isRunning && playbackService == null) { bindService(new Intent(this, PlaybackService.class), mConnection, 0); while (playbackService == null) { try { 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 fc36ad004..979857381 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 @@ -1685,6 +1685,9 @@ public class PlaybackService extends MediaBrowserServiceCompat { * an invalid state. */ public int getDuration() { + if (mediaPlayer == null) { + return INVALID_TIME; + } return mediaPlayer.getDuration(); } @@ -1693,6 +1696,9 @@ public class PlaybackService extends MediaBrowserServiceCompat { * is in an invalid state. */ public int getCurrentPosition() { + if (mediaPlayer == null) { + return INVALID_TIME; + } return mediaPlayer.getPosition(); } |