From a529667257908ddebaa92d36a83380c3c6c40408 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 23 Feb 2020 00:44:51 -0800 Subject: [PATCH] Fixed migration crash when getting chapters --- .../manga/process/MigrationListController.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt index 49e8ace767..e245fb893a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt @@ -23,6 +23,7 @@ import eu.kanade.tachiyomi.smartsearch.SmartSearchEngine import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager +import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.ui.base.controller.BaseController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.main.BottomNavBarInterface @@ -46,6 +47,7 @@ import kotlinx.coroutines.sync.Semaphore import kotlinx.coroutines.sync.withPermit import kotlinx.coroutines.withContext import rx.schedulers.Schedulers +import timber.log.Timber import uy.kohesive.injekt.injectLazy import java.util.concurrent.atomic.AtomicInteger import kotlin.coroutines.CoroutineContext @@ -191,8 +193,13 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle), if (searchResult != null) { val localManga = smartSearchEngine.networkToLocalManga(searchResult, source.id) - val chapters = source.fetchChapterList(localManga).toSingle().await( - Schedulers.io()) + val chapters = try { + source.fetchChapterList(localManga) + .toSingle().await(Schedulers.io()) } + catch (e: java.lang.Exception) { + Timber.e(e) + emptyList() + } ?: emptyList() withContext(Dispatchers.IO) { syncChaptersWithSource(db, chapters, localManga, source) }