mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-15 17:00:36 +03:00
Fix one crash
This commit is contained in:
parent
27b9b0c743
commit
84daba3771
@ -136,7 +136,9 @@ class DownloadService : Service(), KoinComponent {
|
||||
|
||||
// Fill up active List with waiting tasks
|
||||
while (activelyDownloading.size < Settings.parallelDownloads && downloadQueue.size > 0) {
|
||||
val track = downloadQueue.remove()
|
||||
// Use poll() instead of remove() which throws an Exception if there is no element.
|
||||
val track: DownloadableTrack = downloadQueue.poll() ?: continue
|
||||
|
||||
val downloadTask = DownloadTask(track, scope!!, ::downloadStateChangedCallback)
|
||||
activelyDownloading[track] = downloadTask
|
||||
FileUtil.createDirectoryForParent(track.pinnedFile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user