mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-08 19:18:20 +02:00
Trying to fix NPE around these lines.
This commit is contained in:
@@ -43,11 +43,15 @@ object ImageUploader {
|
|||||||
client.newCall(request).enqueue(object : Callback {
|
client.newCall(request).enqueue(object : Callback {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
response.use {
|
response.use {
|
||||||
val tree = jacksonObjectMapper().readTree(response.body!!.string())
|
val body = response.body
|
||||||
val url = tree.get("data").get("link").asText()
|
if (body != null) {
|
||||||
|
val tree = jacksonObjectMapper().readTree(body.string())
|
||||||
|
val url = tree?.get("data")?.get("link")?.asText()
|
||||||
|
if (url != null)
|
||||||
onSuccess(url)
|
onSuccess(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onFailure(call: Call, e: IOException) {
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
Reference in New Issue
Block a user