mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 20:21:48 +01:00
Avoid crash during migration
This commit is contained in:
parent
ae42f59102
commit
f51e32f39b
@ -17,6 +17,8 @@ import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter
|
|||||||
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
||||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.lang.launchUI
|
||||||
|
import eu.kanade.tachiyomi.util.lang.withUIContext
|
||||||
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
class SearchPresenter(
|
class SearchPresenter(
|
||||||
@ -56,11 +58,15 @@ class SearchPresenter(
|
|||||||
replacingMangaRelay.call(true)
|
replacingMangaRelay.call(true)
|
||||||
|
|
||||||
presenterScope.launchIO {
|
presenterScope.launchIO {
|
||||||
val chapters = source.getChapterList(manga.toMangaInfo())
|
try {
|
||||||
.map { it.toSChapter() }
|
val chapters = source.getChapterList(manga.toMangaInfo())
|
||||||
|
.map { it.toSChapter() }
|
||||||
|
|
||||||
|
migrateMangaInternal(source, chapters, prevManga, manga, replace)
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
withUIContext { view?.applicationContext?.toast(e.message) }
|
||||||
|
}
|
||||||
|
|
||||||
migrateMangaInternal(source, chapters, prevManga, manga, replace)
|
|
||||||
}.invokeOnCompletion {
|
|
||||||
presenterScope.launchUI { replacingMangaRelay.call(false) }
|
presenterScope.launchUI { replacingMangaRelay.call(false) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user