mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复JSONUtil.toBean可能的空指针问题
This commit is contained in:
@@ -472,7 +472,11 @@ public class JSONUtil {
|
||||
* @since 4.3.2
|
||||
*/
|
||||
public static <T> T toBean(String jsonString, Type beanType, boolean ignoreError) {
|
||||
return parse(jsonString, JSONConfig.create().setIgnoreError(ignoreError)).toBean(beanType);
|
||||
final JSON json = parse(jsonString, JSONConfig.create().setIgnoreError(ignoreError));
|
||||
if(null == json){
|
||||
return null;
|
||||
}
|
||||
return json.toBean(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user