diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-11-10 17:50:24 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-11-10 17:50:24 -0800 |
commit | 7347f23ad1039b92f0bbfb1e88a80079e33c866c (patch) | |
tree | a891165e210120ab1018122765828cc0f12dfaf1 /app | |
parent | 69958bafdf2bf495a7ac3cd5888e5167cf9d8745 (diff) | |
download | dsub-7347f23ad1039b92f0bbfb1e88a80079e33c866c.tar.gz dsub-7347f23ad1039b92f0bbfb1e88a80079e33c866c.tar.bz2 dsub-7347f23ad1039b92f0bbfb1e88a80079e33c866c.zip |
Fix crash if clearComplete removes current playing
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index bfc9c5d6..40538eae 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -477,6 +477,10 @@ public class DownloadService extends Service { List<DownloadFile> playlist = new ArrayList<>(); if(currentPlaying != null) { int index = downloadList.indexOf(currentPlaying); + if(index == -1) { + index = 0; + } + int size = size(); int end = index + REMOTE_PLAYLIST_TOTAL; for(int i = index; i < size && i < end; i++) { |