aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-12 13:18:50 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-12 13:18:50 -0700
commit9ac927c4c812149802fccdeb42dd66573c2c5281 (patch)
treec16eef42715454ce90c10f52f3b0a668bf93d807 /src
parent2b11caece9c49406099fc192fda4215171ef0f58 (diff)
downloaddsub-9ac927c4c812149802fccdeb42dd66573c2c5281.tar.gz
dsub-9ac927c4c812149802fccdeb42dd66573c2c5281.tar.bz2
dsub-9ac927c4c812149802fccdeb42dd66573c2c5281.zip
Fix crash when starting with nothing in list
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java24
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");
}
}