mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
BugFix invalid upload count string (#2989)
* Added non empty check in response.body() in OkHttpJsonApiClient$getUploadCount
This commit is contained in:
parent
cc0b059595
commit
c4f159ea04
1 changed files with 4 additions and 1 deletions
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue