Fix regression due to incorrect optional use

This commit is contained in:
Rohan Sircar 2020-05-28 00:38:13 +05:30
parent a400e555fa
commit 88105559f7

View File

@ -26,7 +26,7 @@ public class Home {
@RequestMapping("/")
public String showPage(Model model, Principal principal) {
final String welcomeMessage = Optional.of(principal).map(p -> {
final String welcomeMessage = Optional.ofNullable(principal).map(p -> {
return String.format("Welcome back %s!", p.getName());
}).orElse("Welcome to chatto");
model.addAttribute("message", welcomeMessage);