mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 02:11: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
|
val obj = response.jsonObject
|
||||||
return track.apply {
|
return track.apply {
|
||||||
val isRereading = obj["is_rereading"]!!.jsonPrimitive.boolean
|
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
|
last_chapter_read = obj["num_chapters_read"]!!.jsonPrimitive.float
|
||||||
score = obj["score"]!!.jsonPrimitive.int.toFloat()
|
score = obj["score"]!!.jsonPrimitive.int.toFloat()
|
||||||
obj["start_date"]?.let {
|
obj["start_date"]?.let {
|
||||||
|
@ -24,7 +24,7 @@ fun Track.toMyAnimeListStatus() = when (status) {
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getStatus(status: String) = when (status) {
|
fun getStatus(status: String?) = when (status) {
|
||||||
"reading" -> MyAnimeList.READING
|
"reading" -> MyAnimeList.READING
|
||||||
"completed" -> MyAnimeList.COMPLETED
|
"completed" -> MyAnimeList.COMPLETED
|
||||||
"on_hold" -> MyAnimeList.ON_HOLD
|
"on_hold" -> MyAnimeList.ON_HOLD
|
||||||
|
Loading…
Reference in New Issue
Block a user