Fix NullPointer Exception
This commit is contained in:
@@ -21,7 +21,11 @@ public class VisitorRecord implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
|
||||
HashMap<String, Integer> visitDetail = (HashMap<String, Integer>) session.getAttribute("visitDetail");
|
||||
if (visitDetail == null) {
|
||||
return true;
|
||||
}
|
||||
// 获取访问次数
|
||||
Integer count = visitDetail.get(RequestUtil.getCompleteUrlAndMethod(request));
|
||||
// 自增
|
||||
|
||||
Reference in New Issue
Block a user