Fix crash with open in webview after migrate

This commit is contained in:
Jobobby04 2021-07-22 19:46:42 -04:00
parent 698246ee2a
commit 0c3e8f977c
2 changed files with 14 additions and 3 deletions

View File

@ -12,8 +12,6 @@ open class MangaImpl : Manga {
override lateinit var url: String
// SY -->
private val customMangaManager: CustomMangaManager by injectLazy()
override var title: String
get() = if (favorite) {
val customTitle = customMangaManager.getManga(this)?.title
@ -93,4 +91,10 @@ open class MangaImpl : Manga {
override fun hashCode(): Int {
return url.hashCode() + id.hashCode()
}
// SY -->
companion object {
private val customMangaManager: CustomMangaManager by injectLazy()
}
// SY <--
}

View File

@ -36,7 +36,14 @@ class CustomMangaManager(val context: Context) {
}
fun saveMangaInfo(manga: MangaJson) {
if (manga.title == null && manga.author == null && manga.artist == null && manga.description == null && manga.genre == null && manga.status == null) {
if (
manga.title == null &&
manga.author == null &&
manga.artist == null &&
manga.description == null &&
manga.genre == null &&
manga.status == null
) {
customMangaMap.remove(manga.id!!)
} else {
customMangaMap[manga.id!!] = manga.toManga()