mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-15 17:00:36 +03:00
Merge branch 'fixCrashes' into 'develop'
Fix one crash Closes #849 See merge request ultrasonic/ultrasonic!873
This commit is contained in:
commit
2b416c9796
@ -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