Skip to content

Commit

Permalink
Fix MAL main_picture nullability breaking search if a result doesn'…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
MajorTanya authored Jan 3, 2025
1 parent 19af85a commit d608027
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
### Added
- 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
### Changed
- Bump default user agent ([@AntsyLich](https://github.com/AntsyLich)) ([`76dcf90`](https://github.com/mihonapp/mihon/commit/76dcf903403d565056f44c66d965c1ea8affffc3))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class MyAnimeListApi(
summary = it.synopsis
total_chapters = it.numChapters
score = it.mean
cover_url = it.covers.large
cover_url = it.covers?.large.orEmpty()
tracking_url = "https://myanimelist.net/manga/$remote_id"
publishing_status = it.status.replace("_", " ")
publishing_type = it.mediaType.replace("_", " ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class MALManga(
val numChapters: Long,
val mean: Double = -1.0,
@SerialName("main_picture")
val covers: MALMangaCovers,
val covers: MALMangaCovers?,
val status: String,
@SerialName("media_type")
val mediaType: String,
Expand Down

0 comments on commit d608027

Please sign in to comment.