fix two compiler warnings

This commit is contained in:
AdrianLxM 2020-11-29 21:04:26 +01:00
parent b5078e91c7
commit 5024db6748
2 changed files with 3 additions and 3 deletions

View file

@ -43,8 +43,8 @@ class OpenHumansAPI(
.toSingle()
.map { response ->
response.use { _ ->
val body = response.body
val jsonObject = body?.let { JSONObject(it.string()) }
val responseBody = response.body
val jsonObject = responseBody?.let { JSONObject(it.string()) }
if (!response.isSuccessful) throw OHHttpException(response.code, response.message, jsonObject?.getString("error"))
if (jsonObject == null) throw OHHttpException(response.code, response.message, "No body")
if (!jsonObject.has("expires_in")) throw OHMissingFieldException("expires_in")

View file

@ -564,7 +564,7 @@ class OpenHumansUploader @Inject constructor(
creationDate = uploadDate.time
),
content = bytes,
highestQueueId = items.map { it.id }.max()
highestQueueId = items.map { it.id }.maxOrNull()
))
}