[Modify]修改OldHttpErrorHandleUtil,防止空指针

This commit is contained in:
wushaocheng
2023-02-02 10:58:10 +08:00
parent 4a2da59a36
commit c413e53a00

View File

@@ -29,11 +29,11 @@ public class OldHttpErrorHandleUtil {
return ResUtil.getString(R.string.xchat_android_core_utils_oldhttperrorhandleutil_01);
}
return result.getMessage();
} else if (throwable.getMessage().contains("SocketTimeoutException") || throwable.getMessage().contains("ConnectException") || throwable.getMessage().contains("UnknownHostException")) {
} else if (throwable.getMessage() != null && (throwable.getMessage().contains("SocketTimeoutException") || throwable.getMessage().contains("ConnectException") || throwable.getMessage().contains("UnknownHostException"))) {
return ResUtil.getString(R.string.xchat_android_core_utils_oldhttperrorhandleutil_02);
} else if (throwable.getMessage().contains("JsonParseException") || throwable.getMessage().contains("JSONException") || throwable.getMessage().contains("ParseException") ) {
} else if (throwable.getMessage() != null && (throwable.getMessage().contains("JsonParseException") || throwable.getMessage().contains("JSONException") || throwable.getMessage().contains("ParseException"))) {
return ResUtil.getString(R.string.data_parsing_exception);
} else if (throwable.getMessage().contains("IllegalArgumentException")) {
} else if (throwable.getMessage() != null && throwable.getMessage().contains("IllegalArgumentException")) {
return ResUtil.getString(R.string.parameter_error);
} else {
return throwable.getMessage();