Skip to content

Commit

Permalink
fix(myanimelist): Fix nullability and fallback to medium cover if large
Browse files Browse the repository at this point in the history
cover is null
  • Loading branch information
null2264 committed Jan 3, 2025
1 parent e06b28a commit a3672be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
title = it.title
summary = it.synopsis
total_chapters = it.numChapters
cover_url = it.covers.large
cover_url = (it.covers?.large ?: it.covers?.medium).orEmpty()
tracking_url = "https://myanimelist.net/manga/$media_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 All @@ -22,5 +22,6 @@ data class MALManga(

@Serializable
data class MALMangaCovers(
val large: String = "",
val large: String?,
val medium: String,
)

0 comments on commit a3672be

Please sign in to comment.