Fix JSON error when title is null at Tsuki. (#5809)

This commit is contained in:
Alessandro Jean 2021-02-12 17:38:55 -03:00 committed by GitHub
parent 19223f0ce5
commit 09216d222d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Tsuki Mangás' extName = 'Tsuki Mangás'
pkgNameSuffix = 'pt.tsukimangas' pkgNameSuffix = 'pt.tsukimangas'
extClass = '.TsukiMangas' extClass = '.TsukiMangas'
extVersionCode = 9 extVersionCode = 10
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.pt.tsukimangas
import com.github.salomonbrys.kotson.array import com.github.salomonbrys.kotson.array
import com.github.salomonbrys.kotson.int import com.github.salomonbrys.kotson.int
import com.github.salomonbrys.kotson.nullString
import com.github.salomonbrys.kotson.obj import com.github.salomonbrys.kotson.obj
import com.github.salomonbrys.kotson.string import com.github.salomonbrys.kotson.string
import com.google.gson.JsonElement import com.google.gson.JsonElement
@ -224,7 +225,7 @@ class TsukiMangas : HttpSource() {
return obj["versions"].array.map { version -> return obj["versions"].array.map { version ->
SChapter.create().apply { SChapter.create().apply {
name = "Cap. " + obj["number"].string + name = "Cap. " + obj["number"].string +
(if (obj["title"].string.isNotEmpty()) " - " + obj["title"].string else "") (if (!obj["title"].nullString.isNullOrEmpty()) " - " + obj["title"].string else "")
chapter_number = obj["number"].string.toFloatOrNull() ?: -1f chapter_number = obj["number"].string.toFloatOrNull() ?: -1f
scanlator = version.obj["scans"].array scanlator = version.obj["scans"].array
.sortedBy { it.obj["scan"].obj["name"].string } .sortedBy { it.obj["scan"].obj["name"].string }