bug 6818: if the userAccount is null, the user is either removed or does not exist. Since we can't log them out in those cases, just skip saving the logout event (and hence avoid the NPE).

status 6818: resolved fixed
This commit is contained in:
Kris McQueen 2010-10-28 17:35:21 -07:00
parent e2f725308d
commit 640a3dc239
1 changed files with 3 additions and 1 deletions

View File

@ -4535,7 +4535,9 @@ public class ManagementServerImpl implements ManagementServer {
@Override
public void logoutUser(Long userId) {
UserAccount userAcct = _userAccountDao.findById(userId);
EventUtils.saveEvent(userId, userAcct.getAccountId(), EventTypes.EVENT_USER_LOGOUT, "user has logged out");
if (userAcct != null) {
EventUtils.saveEvent(userId, userAcct.getAccountId(), EventTypes.EVENT_USER_LOGOUT, "user has logged out");
} // else log some kind of error event? This likely means the user doesn't exist, or has been deleted...
}
@Override