Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Commit b9d6d9f

Browse files
fix response body handling - kt android
1 parent 24679ff commit b9d6d9f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/target/kt_android.cr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ END
278278
callback(Error(ErrorType.Fatal, "Erro Fatal (502) - Tente novamente"), null)
279279
}
280280
281-
var responseBody: JSONObject? = null
282-
try {
283-
val stringBody = response?.body()?.string()
284-
val responseBody = JSONObject(stringBody)
281+
var responseBody = try {
282+
val stringBody = response?.body()?.string()
283+
JSONObject(stringBody)
285284
} catch (e: Exception) {
286-
callback(Error(ErrorType.Fatal, "502 - Tente novamente"), null)
287-
return
285+
callback(Error(ErrorType.Fatal, "502 - Tente novamente"), null)
286+
null
287+
return
288288
}
289289
290290
val pref = context.getSharedPreferences("api", Context.MODE_PRIVATE)

0 commit comments

Comments
 (0)