mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-30 17:31:50 +01:00
[MyAnimeList] Handle cases where my_list_status.status is not present (#8931)
This commit is contained in:
parent
dc2d470413
commit
b7e6b4c28a
@ -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 New Issue
Block a user