mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-11 21:39:26 +02:00
Trying to fix NPE around these lines.
This commit is contained in:
parent
bbfd060328
commit
2992d9daf0
@ -43,9 +43,13 @@ object ImageUploader {
|
||||
client.newCall(request).enqueue(object : Callback {
|
||||
override fun onResponse(call: Call, response: Response) {
|
||||
response.use {
|
||||
val tree = jacksonObjectMapper().readTree(response.body!!.string())
|
||||
val url = tree.get("data").get("link").asText()
|
||||
onSuccess(url)
|
||||
val body = response.body
|
||||
if (body != null) {
|
||||
val tree = jacksonObjectMapper().readTree(body.string())
|
||||
val url = tree?.get("data")?.get("link")?.asText()
|
||||
if (url != null)
|
||||
onSuccess(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user