mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-17 16:49:43 +02:00
Attempt to fix crash when migrating or removing entries from library (#1828)
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
package tachiyomi.domain.manga.interactor
|
||||
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.retry
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.common.util.system.logcat
|
||||
import tachiyomi.domain.library.model.LibraryManga
|
||||
import tachiyomi.domain.manga.repository.MangaRepository
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class GetLibraryManga(
|
||||
private val mangaRepository: MangaRepository,
|
||||
@@ -14,5 +20,15 @@ class GetLibraryManga(
|
||||
|
||||
fun subscribe(): Flow<List<LibraryManga>> {
|
||||
return mangaRepository.getLibraryMangaAsFlow()
|
||||
.retry {
|
||||
if (it is NullPointerException) {
|
||||
delay(0.5.seconds)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}.catch {
|
||||
this@GetLibraryManga.logcat(LogPriority.ERROR, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user