Skip to content

Commit c434a9c

Browse files
authored
Merge pull request #85 from google/drinckes-patch-4
JS code length validation
2 parents 54837b1 + 7a921b0 commit c434a9c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

js/closure/openlocationcode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function encode(latitude, longitude, opt_length) {
264264
opt_length = PAIR_CODE_LENGTH;
265265
}
266266
if (opt_length < 2 ||
267-
(opt_length < SEPARATOR_POSITION && opt_length % 2 == 1)) {
267+
(opt_length < PAIR_CODE_LENGTH && opt_length % 2 == 1)) {
268268
throw 'IllegalArgumentException: Invalid Open Location Code length';
269269
}
270270
// Ensure that latitude and longitude are valid.

js/src/openlocationcode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
throw ('ValueError: Parameters are not numbers');
287287
}
288288
if (codeLength < 2 ||
289-
(codeLength < SEPARATOR_POSITION_ && codeLength % 2 == 1)) {
289+
(codeLength < PAIR_CODE_LENGTH_ && codeLength % 2 == 1)) {
290290
throw 'IllegalArgumentException: Invalid Open Location Code length';
291291
}
292292
// Ensure that latitude and longitude are valid.

js/src/openlocationcode.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)