]> WPIA git - gigi.git/commitdiff
Fixed an NPE in PasswordStrength checker
authorFelix Dörre <felix@dogcraft.de>
Mon, 23 Jun 2014 23:36:49 +0000 (01:36 +0200)
committerFelix Dörre <felix@dogcraft.de>
Mon, 23 Jun 2014 23:36:49 +0000 (01:36 +0200)
src/org/cacert/gigi/util/PasswordStrengthChecker.java

index 0f72664e5b823b131b46e2f88f6e28e70f0cf187..efc776ef08da4836d2c30701966b87463a38c776 100644 (file)
@@ -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;