Trying to fix NPE around these lines.
This commit is contained in:
@@ -43,9 +43,13 @@ 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) {
|
||||||
onSuccess(url)
|
val tree = jacksonObjectMapper().readTree(body.string())
|
||||||
|
val url = tree?.get("data")?.get("link")?.asText()
|
||||||
|
if (url != null)
|
||||||
|
onSuccess(url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user