Attempt to fix crash when migrating or removing entries from library (#1828)
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> (cherry picked from commit 563bc02113a5ebc53650fdfdd13f408284a0cdc8) # Conflicts: # CHANGELOG.md # app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt # domain/src/main/java/tachiyomi/domain/manga/interactor/GetLibraryManga.kt
This commit is contained in:
parent
8dc6a95ce6
commit
0af667c9aa
@ -2,7 +2,10 @@ 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
|
||||
@ -17,15 +20,15 @@ class GetLibraryManga(
|
||||
|
||||
fun subscribe(): Flow<List<LibraryManga>> {
|
||||
return mangaRepository.getLibraryMangaAsFlow()
|
||||
// SY -->
|
||||
.retry {
|
||||
if (it is NullPointerException) {
|
||||
delay(5.seconds)
|
||||
delay(0.5.seconds)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
}.catch {
|
||||
this@GetLibraryManga.logcat(LogPriority.ERROR, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user