From 7347f23ad1039b92f0bbfb1e88a80079e33c866c Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 10 Nov 2015 17:50:24 -0800 Subject: Fix crash if clearComplete removes current playing --- .../main/java/github/daneren2005/dsub/service/DownloadService.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app') 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 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++) { -- cgit v1.2.3