During migration, only do MangaController replacement if previous controller is also MangaController (#5869)

If previous controller is instead a MigrationController/other, push the new MangaController onto the stack instead
This commit is contained in:
FlaminSarge 2021-09-11 07:21:12 -07:00 committed by GitHub
parent f41bde5ee1
commit 52daf3d58c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,8 +75,14 @@ class SearchController(
if (!isReplacingManga) { if (!isReplacingManga) {
router.popController(this) router.popController(this)
if (newManga != null) { if (newManga != null) {
// Replaces old MangaController val newMangaController = RouterTransaction.with(MangaController(newManga))
router.replaceTopController(RouterTransaction.with(MangaController(newManga))) if (router.backstack.last().controller is MangaController) {
// Replace old MangaController
router.replaceTopController(newMangaController)
} else {
// Push MangaController on top of MigrationController
router.pushController(newMangaController)
}
} }
} }
} }