aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@users.noreply.github.com>2018-10-22 16:22:07 -0700
committerGitHub <noreply@github.com>2018-10-22 16:22:07 -0700
commit676a653eea208e211d784c68b98836853aa442a8 (patch)
tree46fbe98524c56b45d184c38372082af6ccab1684 /app/src/main
parent19895fc4b760793c739dd056d1de1b20df92d820 (diff)
parent361f73ffa001fb6477683eee7f4c23932a234f74 (diff)
downloaddsub-676a653eea208e211d784c68b98836853aa442a8.tar.gz
dsub-676a653eea208e211d784c68b98836853aa442a8.tar.bz2
dsub-676a653eea208e211d784c68b98836853aa442a8.zip
Merge pull request #900 from vrih/fix/download-service-crash-empty-playlist
Fix a crash on getRecentDownloads if playlist is empty
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java2
1 files changed, 1 insertions, 1 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 6c3cfbd7..fc2bc7fc 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -1060,7 +1060,7 @@ public class DownloadService extends Service {
public synchronized List<DownloadFile> getRecentDownloads() {
int from = Math.max(currentPlayingIndex - 10, 0);
int songsToKeep = Math.max(Util.getPreloadCount(this), 20);
- int to = Math.min(currentPlayingIndex + songsToKeep, downloadList.size() - 1);
+ int to = Math.min(currentPlayingIndex + songsToKeep, Math.max(downloadList.size() - 1, 0));
List<DownloadFile> temp = downloadList.subList(from, to);
temp.addAll(backgroundDownloadList);
return temp;