一、问题来源
(1)主要可能是在查询数据库的时候,会返回空对象,那么在没对其处理就直接使用,可能会发生意料之外的灾难。
eg,
User other = userService.getUserByID(user.getId());
//用户已存在
if(other!=null && other.getId().equals(user.getId()))
二、参考博客
https://www.cnblogs.com/niudaben/p/11897961.html

3049

被折叠的 条评论
为什么被折叠?



