BugFix invalid upload count string (#2989)

* Added non empty check in response.body() in OkHttpJsonApiClient$getUploadCount
This commit is contained in:
Ashish Kumar 2019-06-04 18:28:03 +05:30 committed by neslihanturan
parent cc0b059595
commit c4f159ea04

View file

@ -1,5 +1,6 @@
package fr.free.nrw.commons.mwapi;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.gson.Gson;
@ -91,7 +92,9 @@ public class OkHttpJsonApiClient {
return Single.fromCallable(() -> {
Response response = okHttpClient.newCall(request).execute();
if (response != null && response.isSuccessful()) {
return Integer.parseInt(response.body().string().trim());
if(!TextUtils.isEmpty(response.body().string().trim())){
return Integer.parseInt(response.body().string().trim());
}
}
return 0;
});