From 569edd91c96f1ef382e1ff6ea2885aa2b4192caf Mon Sep 17 00:00:00 2001 From: Koitharu Date: Fri, 15 Mar 2024 08:09:51 +0200 Subject: [PATCH] Fix manga migration --- .../org/koitharu/kotatsu/alternatives/domain/MigrateUseCase.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/alternatives/domain/MigrateUseCase.kt b/app/src/main/kotlin/org/koitharu/kotatsu/alternatives/domain/MigrateUseCase.kt index 4a061af87..b771bd9a3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/alternatives/domain/MigrateUseCase.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/alternatives/domain/MigrateUseCase.kt @@ -91,7 +91,7 @@ class MigrateUseCase @Inject constructor( val oldChapters = checkNotNull(oldManga.getChapters(branch)) var index = oldChapters.indexOfFirst { it.id == history.chapterId } if (index < 0) { - index = (oldChapters.size * history.percent).toInt() + index = (oldChapters.lastIndex * history.percent).toInt() } val newChapters = checkNotNull(newManga.chapters).groupBy { it.branch } val newBranch = if (newChapters.containsKey(branch)) {