From: Felix Dörre Date: Mon, 23 Jun 2014 23:36:49 +0000 (+0200) Subject: Fixed an NPE in PasswordStrength checker X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=6b6a343822732845953729656820042966f0b78c Fixed an NPE in PasswordStrength checker --- diff --git a/src/org/cacert/gigi/util/PasswordStrengthChecker.java b/src/org/cacert/gigi/util/PasswordStrengthChecker.java index 0f72664e..efc776ef 100644 --- a/src/org/cacert/gigi/util/PasswordStrengthChecker.java +++ b/src/org/cacert/gigi/util/PasswordStrengthChecker.java @@ -12,7 +12,7 @@ public class PasswordStrengthChecker { static Pattern special = Pattern.compile("\\W"); private PasswordStrengthChecker() { } - public static int checkpwlight(String pw) { + private static int checkpwlight(String pw) { int points = 0; if (pw.length() > 15) { points++; @@ -44,6 +44,9 @@ public class PasswordStrengthChecker { return points; } public static int checkpw(String pw, User u) { + if (pw == null) { + return 0; + } int light = checkpwlight(pw); if (contained(pw, u.getEmail())) { light -= 2;