Fix error when updating manga details with uninitialized title (#8045)
(cherry picked from commit 2ced56e490ecd175b9575eda6514a933f2893a72) # Conflicts: # app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt
This commit is contained in:
parent
bdc45fb8aa
commit
7e7692c3cf
@ -34,10 +34,16 @@ class UpdateManga(
|
|||||||
downloadManager: DownloadManager = Injekt.get(),
|
downloadManager: DownloadManager = Injekt.get(),
|
||||||
// SY <--
|
// SY <--
|
||||||
): Boolean {
|
): Boolean {
|
||||||
// SY -->
|
val remoteTitle = try {
|
||||||
val title = if (remoteManga.title.isNotBlank() && localManga.ogTitle != remoteManga.title) {
|
|
||||||
downloadManager.renameMangaDir(localManga.ogTitle, remoteManga.title, localManga.source)
|
|
||||||
remoteManga.title
|
remoteManga.title
|
||||||
|
} catch (_: UninitializedPropertyAccessException) {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
// SY -->
|
||||||
|
val title = if (remoteTitle.isNotBlank() && localManga.ogTitle != remoteTitle) {
|
||||||
|
downloadManager.renameMangaDir(localManga.ogTitle, remoteTitle, localManga.source)
|
||||||
|
remoteTitle
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
@ -59,16 +65,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…
x
Reference in New Issue
Block a user