diff --git a/src/main/java/com/raysmond/blog/WebConfig.java b/src/main/java/com/raysmond/blog/WebConfig.java index e56e183..5db0610 100644 --- a/src/main/java/com/raysmond/blog/WebConfig.java +++ b/src/main/java/com/raysmond/blog/WebConfig.java @@ -53,7 +53,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView view) { CsrfToken token = (CsrfToken) request.getAttribute(CsrfToken.class.getName()); - if (token != null) { + if (token != null&&view!=null) { view.addObject(token.getParameterName(), token); } }