Fix regression due to incorrect optional use
This commit is contained in:
parent
a400e555fa
commit
88105559f7
@ -26,7 +26,7 @@ public class Home {
|
|||||||
|
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public String showPage(Model model, Principal principal) {
|
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());
|
return String.format("Welcome back %s!", p.getName());
|
||||||
}).orElse("Welcome to chatto");
|
}).orElse("Welcome to chatto");
|
||||||
model.addAttribute("message", welcomeMessage);
|
model.addAttribute("message", welcomeMessage);
|
||||||
|
Loading…
Reference in New Issue
Block a user