From 981a0c6ab6bc9b7da67cf60076064f291a39de49 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 12 Sep 2015 15:36:46 -0700 Subject: Fix trying to save a play queue with a index of -1 --- .../dsub/service/DownloadServiceLifecycleSupport.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/src/main') diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 64da9a13..442d3dc1 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -316,8 +316,15 @@ public class DownloadServiceLifecycleSupport { @Override protected Void doInBackground() throws Throwable { try { + int index = state.currentPlayingIndex; + int position = state.currentPlayingPosition; + if(index == -1) { + index = 0; + position = 0; + } + MusicService musicService = MusicServiceFactory.getMusicService(downloadService); - musicService.savePlayQueue(state.songs, state.songs.get(state.currentPlayingIndex), state.currentPlayingPosition, downloadService, null); + musicService.savePlayQueue(state.songs, state.songs.get(index), position, downloadService, null); currentSavePlayQueueTask = null; } catch (Exception e) { Log.e(TAG, "Failed to save playing queue to server", e); -- cgit v1.2.3