mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 22:03:55 +01:00
fixed the null value warning
This commit is contained in:
parent
10c4baf327
commit
50a8dd941c
1 changed files with 3 additions and 1 deletions
|
|
@ -175,7 +175,9 @@ class OkHttpJsonApiClient @Inject constructor(
|
||||||
.build()
|
.build()
|
||||||
val response: Response = okHttpClient.newCall(request).execute()
|
val response: Response = okHttpClient.newCall(request).execute()
|
||||||
if (response.body != null && response.isSuccessful) {
|
if (response.body != null && response.isSuccessful) {
|
||||||
val json: String = response.body!!.string() ?: return@fromCallable null
|
val json: String? = response.body?.string()
|
||||||
|
if (json.isNullOrEmpty()) {
|
||||||
|
return@fromCallable null }
|
||||||
try {
|
try {
|
||||||
return@fromCallable gson.fromJson<UpdateAvatarResponse>(
|
return@fromCallable gson.fromJson<UpdateAvatarResponse>(
|
||||||
json,
|
json,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue