mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 19:04:39 -05:00
Fix NullPointerException (#2056)
This commit is contained in:
@@ -291,18 +291,18 @@ object Chapter {
|
|||||||
this[ChapterTable.fetchedAt] = it
|
this[ChapterTable.fetchedAt] = it
|
||||||
}
|
}
|
||||||
|
|
||||||
val deletedChapter = deletedDownloadedChapterNumberToChapter[chapter.chapterNumber]!!
|
deletedDownloadedChapterNumberToChapter[chapter.chapterNumber]?.let {
|
||||||
|
val hasDownloadedPages = it.pageCount > 0
|
||||||
|
val isSameName = it.name == chapter.name
|
||||||
|
val isSameScanlator = it.scanlator == chapter.scanlator
|
||||||
|
|
||||||
val hasDownloadedPages = deletedChapter.pageCount > 0
|
// Only preserve download status for chapters with the same name and of the same scanlator; otherwise,
|
||||||
val isSameName = deletedChapter.name == chapter.name
|
// the downloaded files won't be found anyway
|
||||||
val isSameScanlator = deletedChapter.scanlator == chapter.scanlator
|
val isDownloadPreservable = hasDownloadedPages && isSameName && isSameScanlator
|
||||||
|
if (isDownloadPreservable) {
|
||||||
// Only preserve download status for chapters with the same name and of the same scanlator; otherwise,
|
this[ChapterTable.isDownloaded] = true
|
||||||
// the downloaded files won't be found anyway
|
this[ChapterTable.pageCount] = it.pageCount
|
||||||
val isDownloadPreservable = hasDownloadedPages && isSameName && isSameScanlator
|
}
|
||||||
if (isDownloadPreservable) {
|
|
||||||
this[ChapterTable.isDownloaded] = true
|
|
||||||
this[ChapterTable.pageCount] = deletedChapter.pageCount
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.forEach { insertedChapters.add(ChapterTable.toDataClass(it)) }
|
}.forEach { insertedChapters.add(ChapterTable.toDataClass(it)) }
|
||||||
|
|||||||
Reference in New Issue
Block a user