diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-07-12 13:18:50 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-07-12 13:18:50 -0700 |
commit | 9ac927c4c812149802fccdeb42dd66573c2c5281 (patch) | |
tree | c16eef42715454ce90c10f52f3b0a668bf93d807 /src/github | |
parent | 2b11caece9c49406099fc192fda4215171ef0f58 (diff) | |
download | dsub-9ac927c4c812149802fccdeb42dd66573c2c5281.tar.gz dsub-9ac927c4c812149802fccdeb42dd66573c2c5281.tar.bz2 dsub-9ac927c4c812149802fccdeb42dd66573c2c5281.zip |
Fix crash when starting with nothing in list
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadService.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 44c22009..f458379d 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -998,17 +998,21 @@ public class DownloadService extends Service { } public synchronized void resetNext() { - if(nextMediaPlayer != null) { - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - mediaPlayer.setNextMediaPlayer(null); - nextSetup = false; - } + try { + if (nextMediaPlayer != null) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && nextSetup) { + mediaPlayer.setNextMediaPlayer(null); + nextSetup = false; + } - nextMediaPlayer.setOnCompletionListener(null); - nextMediaPlayer.setOnErrorListener(null); - nextMediaPlayer.reset(); - nextMediaPlayer.release(); - nextMediaPlayer = null; + nextMediaPlayer.setOnCompletionListener(null); + nextMediaPlayer.setOnErrorListener(null); + nextMediaPlayer.reset(); + nextMediaPlayer.release(); + nextMediaPlayer = null; + } + } catch (Exception e) { + Log.w(TAG, "Failed to reset next media player"); } } |