fix: Crash when trying to edit an entry

Fixes GH-65
This commit is contained in:
Ahmad Ansori Palembani 2024-05-30 08:04:36 +07:00
parent 2341e21148
commit efc2a23cb6
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 12 additions and 3 deletions

View file

@ -197,7 +197,7 @@ class CustomMangaManager(val context: Context) {
author: String? = null, author: String? = null,
artist: String? = null, artist: String? = null,
description: String? = null, description: String? = null,
genre: String = "", genre: String? = null,
status: Int? = null, status: Int? = null,
): ComicInfoYokai { ): ComicInfoYokai {
return ComicInfoYokai( return ComicInfoYokai(
@ -214,7 +214,7 @@ class CustomMangaManager(val context: Context) {
coverArtist = null, coverArtist = null,
translator = null, translator = null,
summary = description?.let { ComicInfo.Summary(it) }, summary = description?.let { ComicInfo.Summary(it) },
genre = genre.takeIf { it.isNotEmpty() }?.let { ComicInfo.Genre(it) }, genre = genre?.let { ComicInfo.Genre(it) },
tags = null, tags = null,
web = null, web = null,
publishingStatus = status.takeUnless { it == 0 }?.let { publishingStatus = status.takeUnless { it == 0 }?.let {
@ -235,5 +235,6 @@ class CustomMangaManager(val context: Context) {
private fun mangaFromComicInfoObject(id: Long, comicInfo: ComicInfo) = MangaImpl().apply { private fun mangaFromComicInfoObject(id: Long, comicInfo: ComicInfo) = MangaImpl().apply {
this.id = id this.id = id
this.copyFromComicInfo(comicInfo) this.copyFromComicInfo(comicInfo)
this.title = comicInfo.series?.value ?: ""
} }
} }

View file

@ -712,7 +712,15 @@ class MangaDetailsPresenter(
fun confirmDeletion() { fun confirmDeletion() {
launchIO { launchIO {
coverCache.deleteFromCache(manga) coverCache.deleteFromCache(manga)
customMangaManager.saveMangaInfo(CustomMangaManager.ComicList.ComicInfoYokai.create(manga.id!!)) customMangaManager.saveMangaInfo(CustomMangaManager.ComicList.ComicInfoYokai.create(
id = manga.id!!,
title = null,
author = null,
artist = null,
description = null,
genre = null as String?,
status = null,
))
downloadManager.deleteManga(manga, source) downloadManager.deleteManga(manga, source)
asyncUpdateMangaAndChapters(true) asyncUpdateMangaAndChapters(true)
} }