diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt index c0f0fa3e7..046ebd51e 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt @@ -80,6 +80,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { } } ?: download(book, chapter) } + }.onError { + synchronized(loadingLock) { + loadingChapters.remove(index) + } } } @@ -94,6 +98,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { download(book, chapter) } } + }.onError { + synchronized(loadingLock) { + loadingChapters.remove(index) + } } } @@ -107,6 +115,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { loadingChapters.remove(chapter.index) } } + }?.onError { + synchronized(loadingLock) { + loadingChapters.remove(chapter.index) + } } }