Skip to content

Commit

Permalink
update Java for short, odd code lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
drinckes committed Dec 24, 2024
1 parent 9bfdf78 commit efdaee0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public OpenLocationCode(double latitude, double longitude, int codeLength) {
// Limit the maximum number of digits in the code.
codeLength = Math.min(codeLength, MAX_DIGIT_COUNT);
// Check that the code length requested is valid.
if (codeLength < PAIR_CODE_LENGTH && codeLength % 2 == 1 || codeLength < 4) {
if (codeLength < 2) {
throw new IllegalArgumentException("Illegal code length " + codeLength);
}
// Ensure that latitude and longitude are valid.
Expand Down

0 comments on commit efdaee0

Please sign in to comment.