From f518acb8eecddc91630d9717059b50862ee17e70 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sun, 29 Sep 2024 19:46:42 +0300 Subject: [PATCH] Skip error for local manga list (close #1113, close #1115) --- .../koitharu/kotatsu/local/data/LocalMangaRepository.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalMangaRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalMangaRepository.kt index f2c6ae588..9b99de67a 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalMangaRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalMangaRepository.kt @@ -230,9 +230,12 @@ class LocalMangaRepository @Inject constructor( val dispatcher = Dispatchers.IO.limitedParallelism(MAX_PARALLELISM) for (file in files) { launch(dispatcher) { - val m = LocalMangaInput.ofOrNull(file)?.getManga() - if (m != null) { - send(m) + runCatchingCancellable { + LocalMangaInput.ofOrNull(file)?.getManga() + }.onFailure { e -> + e.printStackTraceDebug() + }.onSuccess { m -> + if (m != null) send(m) } } }