Use a empty title if none is found

This commit is contained in:
Jobobby04 2021-07-11 21:24:24 -04:00
parent a856ea20b4
commit 866c4a77a3
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ class ApiMangaParser(
try {
val mangaAttributesDto = mangaDto.data.attributes
mdUuid = mangaDto.data.id
title = MdUtil.cleanString(mangaAttributesDto.title.asMdMap().let { it[lang] ?: it["en"]!! })
title = MdUtil.cleanString(mangaAttributesDto.title.asMdMap().let { it[lang] ?: it["en"].orEmpty() })
altTitles = mangaAttributesDto.altTitles.mapNotNull { it[lang] }.nullIfEmpty()
mangaDto.relationships

View File

@ -265,7 +265,7 @@ class MdUtil {
fun createMangaEntry(json: MangaDto, lang: String): MangaInfo {
return MangaInfo(
key = buildMangaUrl(json.data.id),
title = cleanString(json.data.attributes.title.asMdMap().let { it[lang] ?: it["en"]!! }),
title = cleanString(json.data.attributes.title.asMdMap().let { it[lang] ?: it["en"].orEmpty() }),
cover = json.relationships
.firstOrNull { relationshipDto -> relationshipDto.type == MdConstants.Types.coverArt }
?.attributes