diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-04-09 20:40:31 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-04-09 20:40:31 -0700 |
commit | 329f627571c4551e0277f1790f60fd56647867bc (patch) | |
tree | c56d87295aad408f636342d6db9f04cdce262e6b /subsonic-android | |
parent | fd8fe0b59f21763f8335a4750198cb8068d1600e (diff) | |
download | dsub-329f627571c4551e0277f1790f60fd56647867bc.tar.gz dsub-329f627571c4551e0277f1790f60fd56647867bc.tar.bz2 dsub-329f627571c4551e0277f1790f60fd56647867bc.zip |
Surround with try, catch for case when in uninitialized state
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 4cdeeb94..3dcbf6bb 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -1056,7 +1056,11 @@ public class DownloadServiceImpl extends Service implements DownloadService { try { final File file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile(); nextMediaPlayer.setOnCompletionListener(null); - nextMediaPlayer.setNextMediaPlayer(null); + try { + nextMediaPlayer.setNextMediaPlayer(null); + } catch(Exception e) { + // Don't care, should only reach here if this is happening from uninitialized media player + } nextMediaPlayer.reset(); setNextPlayerState(IDLE); nextMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); @@ -1064,11 +1068,11 @@ public class DownloadServiceImpl extends Service implements DownloadService { setNextPlayerState(PREPARING); nextMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { - public void onPrepared(MediaPlayer mediaPlayer) { + public void onPrepared(MediaPlayer mp) { try { setNextPlayerState(PREPARED); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && playerState == PlayerState.STARTED) { - DownloadServiceImpl.this.mediaPlayer.setNextMediaPlayer(nextMediaPlayer); + mediaPlayer.setNextMediaPlayer(nextMediaPlayer); nextSetup = true; } } catch (Exception x) { |