Fix some crashes

This commit is contained in:
arkon
2022-01-02 11:25:35 -05:00
parent 2d03f3ce1e
commit 0b9d436753
5 changed files with 35 additions and 19 deletions

View File

@@ -176,13 +176,15 @@ class DownloadService : Service() {
* Listens to downloader status. Enables or disables the wake lock depending on the status.
*/
private fun listenDownloaderState() {
subscriptions += downloadManager.runningRelay.subscribe { running ->
if (running) {
wakeLock.acquireIfNeeded()
} else {
wakeLock.releaseIfNeeded()
subscriptions += downloadManager.runningRelay
.doOnError { /* Swallow wakelock error */ }
.subscribe { running ->
if (running) {
wakeLock.acquireIfNeeded()
} else {
wakeLock.releaseIfNeeded()
}
}
}
}
/**