Skip to content

Commit b40435b

Browse files
committed
(Issue 52) Bugfix for unexpected TypeError when maxLength rule receives undefined input
1 parent 0b083e7 commit b40435b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rules/maxLength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function maxLength({ attr, value, args }) {
66
throw new Error(`Seed in maxLength rule for ${attr} must be a number.`);
77
}
88

9-
if (value.toString().length > parseInt(maxNum)) {
9+
if (value && value.toString().length > parseInt(maxNum)) {
1010
return false;
1111
}
1212

0 commit comments

Comments
 (0)