mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-29 02:58:51 +03:00
[MyAnimeList] Handle cases where my_list_status.status is not present (#8931)
This commit is contained in:
parent
dc2d470413
commit
b7e6b4c28a
2 changed files with 2 additions and 2 deletions
|
@ -208,7 +208,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
|||
val obj = response.jsonObject
|
||||
return track.apply {
|
||||
val isRereading = obj["is_rereading"]!!.jsonPrimitive.boolean
|
||||
status = if (isRereading) MyAnimeList.REREADING else getStatus(obj["status"]!!.jsonPrimitive.content)
|
||||
status = if (isRereading) MyAnimeList.REREADING else getStatus(obj["status"]?.jsonPrimitive?.content)
|
||||
last_chapter_read = obj["num_chapters_read"]!!.jsonPrimitive.float
|
||||
score = obj["score"]!!.jsonPrimitive.int.toFloat()
|
||||
obj["start_date"]?.let {
|
||||
|
|
|
@ -24,7 +24,7 @@ fun Track.toMyAnimeListStatus() = when (status) {
|
|||
else -> null
|
||||
}
|
||||
|
||||
fun getStatus(status: String) = when (status) {
|
||||
fun getStatus(status: String?) = when (status) {
|
||||
"reading" -> MyAnimeList.READING
|
||||
"completed" -> MyAnimeList.COMPLETED
|
||||
"on_hold" -> MyAnimeList.ON_HOLD
|
||||
|
|
Loading…
Reference in a new issue