fixed the null value warning

This commit is contained in:
sonalyadav 2024-12-19 19:35:58 +05:30 committed by Sonal Yadav
parent 10c4baf327
commit 50a8dd941c

View file

@ -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,