Skip to content
Snippets Groups Projects
Commit 2faec40c authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Make sure we don't have nulls lying around

parent ebf52e17
No related branches found
No related tags found
No related merge requests found
...@@ -180,7 +180,12 @@ public class SignupFormAction implements FormAction, FormActionFactory { ...@@ -180,7 +180,12 @@ public class SignupFormAction implements FormAction, FormActionFactory {
Stream<String> unimailDomainsStream = Arrays.stream(unimailDomains); Stream<String> unimailDomainsStream = Arrays.stream(unimailDomains);
if (!unimailDomainsStream.anyMatch( f -> email.endsWith(f) )) { if (
// If `email` is null or empty it's not an unimail address
email == null || email.trim().length() == 0 ||
// If `email` doesn't end with at least one unimail domain
unimailDomainsStream.noneMatch( f -> f != null && email.endsWith(f) )
) {
errors.add(new FormMessage(Validation.FIELD_EMAIL, "notInUnimailDomainsMessage")); errors.add(new FormMessage(Validation.FIELD_EMAIL, "notInUnimailDomainsMessage"));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment