mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 12:37:47 +01:00
Fix error when updating manga details with uninitialized title (#8045)
This commit is contained in:
parent
e568951396
commit
2ced56e490
1 changed files with 11 additions and 3 deletions
|
@ -30,8 +30,14 @@ class UpdateManga(
|
||||||
manualFetch: Boolean,
|
manualFetch: Boolean,
|
||||||
coverCache: CoverCache = Injekt.get(),
|
coverCache: CoverCache = Injekt.get(),
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
val remoteTitle = try {
|
||||||
|
remoteManga.title
|
||||||
|
} catch (_: UninitializedPropertyAccessException) {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
// if the manga isn't a favorite, set its title from source and update in db
|
// if the manga isn't a favorite, set its title from source and update in db
|
||||||
val title = if (!localManga.favorite) remoteManga.title else null
|
val title = if (remoteTitle.isEmpty() || localManga.favorite) null else remoteTitle
|
||||||
|
|
||||||
val coverLastModified =
|
val coverLastModified =
|
||||||
when {
|
when {
|
||||||
|
@ -49,16 +55,18 @@ class UpdateManga(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val thumbnailUrl = remoteManga.thumbnail_url?.takeIf { it.isNotEmpty() }
|
||||||
|
|
||||||
return mangaRepository.update(
|
return mangaRepository.update(
|
||||||
MangaUpdate(
|
MangaUpdate(
|
||||||
id = localManga.id,
|
id = localManga.id,
|
||||||
title = title?.takeIf { it.isNotEmpty() },
|
title = title,
|
||||||
coverLastModified = coverLastModified,
|
coverLastModified = coverLastModified,
|
||||||
author = remoteManga.author,
|
author = remoteManga.author,
|
||||||
artist = remoteManga.artist,
|
artist = remoteManga.artist,
|
||||||
description = remoteManga.description,
|
description = remoteManga.description,
|
||||||
genre = remoteManga.getGenres(),
|
genre = remoteManga.getGenres(),
|
||||||
thumbnailUrl = remoteManga.thumbnail_url?.takeIf { it.isNotEmpty() },
|
thumbnailUrl = thumbnailUrl,
|
||||||
status = remoteManga.status.toLong(),
|
status = remoteManga.status.toLong(),
|
||||||
initialized = true,
|
initialized = true,
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue