From 52daf3d58c57a0973dafb43e84a9e9f5c34f2da3 Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Sat, 11 Sep 2021 07:21:12 -0700 Subject: [PATCH] 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 --- .../ui/browse/migration/search/SearchController.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt index 079dc2808..b6fa0ecac 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt @@ -75,8 +75,14 @@ class SearchController( if (!isReplacingManga) { router.popController(this) if (newManga != null) { - // Replaces old MangaController - router.replaceTopController(RouterTransaction.with(MangaController(newManga))) + val newMangaController = 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) + } } } }