Fix crash in migration if there are no viable chapter numbers
This commit is contained in:
parent
13f4bfa7bc
commit
f4c6b2e09c
@ -104,7 +104,7 @@ class MigrationProcessAdapter(
|
||||
if (MigrationFlags.hasChapters(flags)) {
|
||||
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
||||
val maxChapterRead =
|
||||
prevMangaChapters.filter { it.read }.maxOf { it.chapter_number }
|
||||
prevMangaChapters.filter { it.read }.maxOfOrNull { it.chapter_number }
|
||||
val dbChapters = db.getChapters(manga).executeAsBlocking()
|
||||
val prevHistoryList = db.getHistoryByMangaId(prevManga.id!!).executeAsBlocking()
|
||||
val historyList = mutableListOf<History>()
|
||||
@ -120,7 +120,7 @@ class MigrationProcessAdapter(
|
||||
val history = History.create(chapter).apply { last_read = prevHistory.last_read }
|
||||
historyList.add(history)
|
||||
}
|
||||
} else if (chapter.chapter_number <= maxChapterRead) {
|
||||
} else if (maxChapterRead != null && chapter.chapter_number <= maxChapterRead) {
|
||||
chapter.read = true
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user