Skip to content

Commit

Permalink
fix: allow null response in logout
Browse files Browse the repository at this point in the history
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout.

Fixes: #20017
  • Loading branch information
tltv committed Sep 25, 2024
1 parent 69e2800 commit 177b55e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ public boolean isAuthenticated() {
public void logout() {
HttpServletRequest request = VaadinServletRequest.getCurrent()
.getHttpServletRequest();
HttpServletResponse response = VaadinServletResponse.getCurrent()
.getHttpServletResponse();
HttpServletResponse response = Optional
.ofNullable(VaadinServletResponse.getCurrent())
.map(VaadinServletResponse::getHttpServletResponse)
.orElse(null);
Authentication auth = SecurityContextHolder.getContext()
.getAuthentication();

Expand Down

0 comments on commit 177b55e

Please sign in to comment.