aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-04-09 20:40:31 -0700
committerScott Jackson <daneren2005@gmail.com>2013-04-09 20:40:31 -0700
commit329f627571c4551e0277f1790f60fd56647867bc (patch)
treec56d87295aad408f636342d6db9f04cdce262e6b /subsonic-android
parentfd8fe0b59f21763f8335a4750198cb8068d1600e (diff)
downloaddsub-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.java10
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) {