3216 NPE med användare utan identifier

This commit is contained in:
Wayne Westmoreland 2023-10-05 21:50:20 +02:00
parent b6df7ec299
commit 19840f5641

@ -73,7 +73,10 @@ public class DaisyPicture extends ResourceReference {
final int userId = attributes.getParameters().get(USER_ID).toInt(0);
final boolean alwaysShow = projectRelations.contains(userId) || seminarRelations.contains(userId);
Integer requesterDaisyId = session.getUser().getIdentifier();
Integer requesterDaisyId = null;
if(session.getUser() != null){
requesterDaisyId = session.getUser().getIdentifier();
}
final PhotoResult photo = daisyAPI.getPhoto(userId, requesterDaisyId == null ? -1 : requesterDaisyId, alwaysShow);
return photo.fold(this::noPhoto, this::noPhoto, this::showPhoto);
}