From d09eca7833b97cd912779c761ea5305dda9952e7 Mon Sep 17 00:00:00 2001 From: len Date: Fri, 23 Dec 2016 16:15:09 +0100 Subject: [PATCH] Anilist/Kitsu Fixes --- .../java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt | 1 + .../java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt index d8ef82d301..82ec5fa4af 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt @@ -51,6 +51,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) { .map { list -> list.filter { it.type != "Novel" }.map { it.toTrack() } } + .onErrorReturn { emptyList() } } fun getList(username: String): Observable> { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt index 42af1640ed..9c769225f9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt @@ -9,7 +9,7 @@ import eu.kanade.tachiyomi.data.track.TrackManager open class KitsuManga(obj: JsonObject) { val id by obj.byInt val canonicalTitle by obj["attributes"].byString - val chapterCount = obj["attributes"]["chapterCount"].nullInt + val chapterCount = obj["attributes"].obj.get("chapterCount").nullInt @CallSuper open fun toTrack() = Track.create(TrackManager.KITSU).apply { @@ -22,7 +22,7 @@ open class KitsuManga(obj: JsonObject) { class KitsuLibManga(obj: JsonObject, manga: JsonObject) : KitsuManga(manga) { val remoteId by obj.byInt("id") val status by obj["attributes"].byString - val rating = obj["attributes"]["rating"].nullString + val rating = obj["attributes"].obj.get("rating").nullString val progress by obj["attributes"].byInt override fun toTrack() = super.toTrack().apply {