Skip to content

Commit

Permalink
Fix that profile page would have an NPE when e-mail is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
penguineer committed Jul 20, 2024
1 parent aea187b commit 40058ca
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
import jakarta.annotation.security.PermitAll;
import org.springframework.beans.factory.annotation.Qualifier;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.function.Supplier;

@Route(value = "profile", layout = AdminLayout.class)
Expand Down Expand Up @@ -50,9 +47,9 @@ public ProfilePage(@Qualifier("user") Supplier<UserDTO> currentUser,

List<Map.Entry<String, String>> items = new ArrayList<>();
userOpt.ifPresent(userDTO -> {
items.add(Map.entry("Name", userDTO.displayName()));
items.add(Map.entry("E-Mail-Adresse", userDTO.email()));
items.add(Map.entry("Avatar-URL", userDTO.avatarUrl().toASCIIString()));
items.add(Map.entry("Name", Objects.requireNonNullElse(userDTO.displayName(), "<leer>")));
items.add(Map.entry("E-Mail-Adresse", Objects.requireNonNullElse(userDTO.email(), "<leer>")));
items.add(Map.entry("Avatar-URL", userDTO.avatarUrl() == null ? "<leer>" : userDTO.avatarUrl().toASCIIString()));
});

grid.setItems(items);
Expand Down

0 comments on commit 40058ca

Please sign in to comment.