Avoid to lost the composed message when an error occurs

This commit is contained in:
tom79 2020-02-04 18:40:28 +01:00
parent 7af7c51520
commit fd0cf63439
2 changed files with 3 additions and 2 deletions

View File

@ -2683,7 +2683,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
showAToast(apiResponse.getError().getError());
return;
}
}
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
boolean split_toot = sharedpreferences.getBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS + userId + instance, false);

View File

@ -52,6 +52,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -4719,6 +4720,7 @@ public class API {
e.printStackTrace();
} catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) {
e.printStackTrace();
setDefaultError(e);
}
apiResponse.setStatuses(statuses);
return apiResponse;
@ -6469,7 +6471,7 @@ public class API {
APIError.setStatusCode(statusCode);
String message = statusCode + " - " + error.getMessage();
try {
JSONObject jsonObject = new JSONObject(error.getMessage());
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(error.getMessage()));
String errorM = jsonObject.get("error").toString();
message = "Error " + statusCode + " : " + errorM;
} catch (JSONException e) {