From 93ba6acea56334573fc506d593affd5bea2a86b2 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sat, 1 Nov 2025 01:42:42 +0600 Subject: [PATCH] Fix migration "Attempt to invoke virtual method" crash (#2632) --- CHANGELOG.md | 1 + .../migration/config/MigrationConfigScreen.kt | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49789fe08..c799b6e93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - Fix disabling incognito mode from notification ([@NGB-Was-Taken](https://github.com/NGB-Was-Taken)) ([#2512](https://github.com/mihonapp/mihon/pull/2512)) - Fix mass migration advanced search query building ([@AntsyLich](https://github.com/AntsyLich)) ([#2629](https://github.com/mihonapp/mihon/pull/2629)) - Fix migration dialog migrating to wrong entry ([@AntsyLich](https://github.com/AntsyLich)) ([#2631](https://github.com/mihonapp/mihon/pull/2631)) +- Fix migration "Attempt to invoke virtual method" crash ([@AntsyLich](https://github.com/AntsyLich)) ([#2632](https://github.com/mihonapp/mihon/pull/2632)) ### Other - Fix Kitsu tracker to conform to tracker data structure properly ([@cpiber](https://github.com/cpiber)) ([#2609](https://github.com/mihonapp/mihon/pull/2609)) diff --git a/app/src/main/java/mihon/feature/migration/config/MigrationConfigScreen.kt b/app/src/main/java/mihon/feature/migration/config/MigrationConfigScreen.kt index 580539c48..45d683e8b 100644 --- a/app/src/main/java/mihon/feature/migration/config/MigrationConfigScreen.kt +++ b/app/src/main/java/mihon/feature/migration/config/MigrationConfigScreen.kt @@ -315,13 +315,6 @@ class MigrationConfigScreen(private val mangaIds: Collection) : Screen() { private val sourceManager: SourceManager = Injekt.get(), ) : StateScreenModel(State()) { - init { - screenModelScope.launchIO { - initSources() - mutableState.update { it.copy(isLoading = false) } - } - } - private val sourcesComparator = { includedSources: List -> compareBy( { !it.isSelected }, @@ -330,6 +323,13 @@ class MigrationConfigScreen(private val mangaIds: Collection) : Screen() { ) } + init { + screenModelScope.launchIO { + initSources() + mutableState.update { it.copy(isLoading = false) } + } + } + private fun updateSources(save: Boolean = true, action: (List) -> List) { mutableState.update { state -> val updatedSources = action(state.sources)