- checked for possible NPE being thrown



git-svn-id: https://svn.apache.org/repos/asf/struts/action2/trunk@416987 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Toby Jee
2006-06-25 06:52:48 +00:00
parent afd82ee623
commit 0f2b0fb9cf
@@ -38,10 +38,12 @@ public class ChatSessionListener implements HttpSessionListener {
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
if (context != null) {
User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY);
ChatService service = (ChatService) context.getBean("chatService");
service.logout(user.getName());
_log.info("session expired, logged user ["+user.getName()+"] out");
if (user != null) {
ChatService service = (ChatService) context.getBean("chatService");
service.logout(user.getName());
_log.info("session expired, logged user ["+user.getName()+"] out");
}
}
}