aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java9
1 files changed, 8 insertions, 1 deletions
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);