From 9df7f7989d08d37526be716f12aefc34408504cb Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sun, 14 Oct 2012 12:40:47 +0200 Subject: [PATCH] Prevented IllegalStateException when calling getDurationSafe() --- src/de/danoeh/antennapod/service/PlaybackService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java index 48a1f4d41..05a438087 100644 --- a/src/de/danoeh/antennapod/service/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/PlaybackService.java @@ -766,7 +766,8 @@ public class PlaybackService extends Service { * @param abandonFocus * is true if the service should release audio focus * @param reset - * is true if service should reinit after pausing if the media file is being streamed + * is true if service should reinit after pausing if the media + * file is being streamed */ public void pause(boolean abandonFocus, boolean reinit) { if (player.isPlaying()) { @@ -1226,7 +1227,12 @@ public class PlaybackService extends Service { case PLAYING: case PAUSED: case SEEKING: - return player.getDuration(); + try { + return player.getDuration(); + } catch (IllegalStateException e) { + e.printStackTrace(); + return INVALID_TIME; + } default: return INVALID_TIME; }