Fix Tappytoon crash. (#15148)
This commit is contained in:
parent
42720260d1
commit
9675111870
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'Tappytoon'
|
extName = 'Tappytoon'
|
||||||
pkgNameSuffix = 'all.tappytoon'
|
pkgNameSuffix = 'all.tappytoon'
|
||||||
extClass = '.TappytoonFactory'
|
extClass = '.TappytoonFactory'
|
||||||
extVersionCode = 6
|
extVersionCode = 7
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.io.IOException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -45,11 +46,11 @@ class Tappytoon(override val lang: String) : HttpSource() {
|
||||||
// Throw JSON error if available
|
// Throw JSON error if available
|
||||||
if (mime == "application/json") {
|
if (mime == "application/json") {
|
||||||
res.body?.string()?.let(json::parseToJsonElement)?.run {
|
res.body?.string()?.let(json::parseToJsonElement)?.run {
|
||||||
throw Error(jsonObject["message"]!!.jsonPrimitive.content)
|
throw IOException(jsonObject["message"]!!.jsonPrimitive.content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.close()
|
res.close()
|
||||||
throw Error("HTTP error ${res.code}")
|
throw IOException("HTTP error ${res.code}")
|
||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
private val json by injectLazy<Json>()
|
private val json by injectLazy<Json>()
|
||||||
|
|
Loading…
Reference in New Issue