Fix MAL main_picture nullability breaking search if a result doesn't have a cover set (#1618)

* Fix MAL manga cover nullability

If a manga doesn't have a cover, MAL doesn't provide the
`main_picture` element in the API response at all.

* Add CHANGELOG.md entry
This commit is contained in:
MajorTanya 2025-01-03 23:19:11 +01:00 committed by GitHub
parent 19af85ab61
commit d60802721b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -14,6 +14,9 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
### Added ### Added
- Add option to always decode long strip images with SSIV - Add option to always decode long strip images with SSIV
### Fixed
- Fix MAL `main_picture` nullability breaking search if a result doesn't have a cover set ([@MajorTanya](https://github.com/MajorTanya)) ([#1618](https://github.com/mihonapp/mihon/pull/1618))
## [v0.17.1] - 2024-12-06 ## [v0.17.1] - 2024-12-06
### Changed ### Changed
- Bump default user agent ([@AntsyLich](https://github.com/AntsyLich)) ([`76dcf90`](https://github.com/mihonapp/mihon/commit/76dcf903403d565056f44c66d965c1ea8affffc3)) - Bump default user agent ([@AntsyLich](https://github.com/AntsyLich)) ([`76dcf90`](https://github.com/mihonapp/mihon/commit/76dcf903403d565056f44c66d965c1ea8affffc3))

View File

@ -111,7 +111,7 @@ class MyAnimeListApi(
summary = it.synopsis summary = it.synopsis
total_chapters = it.numChapters total_chapters = it.numChapters
score = it.mean score = it.mean
cover_url = it.covers.large cover_url = it.covers?.large.orEmpty()
tracking_url = "https://myanimelist.net/manga/$remote_id" tracking_url = "https://myanimelist.net/manga/$remote_id"
publishing_status = it.status.replace("_", " ") publishing_status = it.status.replace("_", " ")
publishing_type = it.mediaType.replace("_", " ") publishing_type = it.mediaType.replace("_", " ")

View File

@ -12,7 +12,7 @@ data class MALManga(
val numChapters: Long, val numChapters: Long,
val mean: Double = -1.0, val mean: Double = -1.0,
@SerialName("main_picture") @SerialName("main_picture")
val covers: MALMangaCovers, val covers: MALMangaCovers?,
val status: String, val status: String,
@SerialName("media_type") @SerialName("media_type")
val mediaType: String, val mediaType: String,