[Modify]修改OldHttpErrorHandleUtil,防止空指针
This commit is contained in:
@@ -29,11 +29,11 @@ public class OldHttpErrorHandleUtil {
|
|||||||
return ResUtil.getString(R.string.xchat_android_core_utils_oldhttperrorhandleutil_01);
|
return ResUtil.getString(R.string.xchat_android_core_utils_oldhttperrorhandleutil_01);
|
||||||
}
|
}
|
||||||
return result.getMessage();
|
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);
|
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);
|
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);
|
return ResUtil.getString(R.string.parameter_error);
|
||||||
} else {
|
} else {
|
||||||
return throwable.getMessage();
|
return throwable.getMessage();
|
||||||
|
Reference in New Issue
Block a user