aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-11-10 17:50:24 -0800
committerScott Jackson <daneren2005@gmail.com>2015-11-10 17:50:24 -0800
commit7347f23ad1039b92f0bbfb1e88a80079e33c866c (patch)
treea891165e210120ab1018122765828cc0f12dfaf1 /app
parent69958bafdf2bf495a7ac3cd5888e5167cf9d8745 (diff)
downloaddsub-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.java4
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++) {