Skip to content

Commit f0a9a83

Browse files
authored
Merge pull request #81 from WilliamDenniss/pythonfix
Fixed codeLength input validation in the encode method.
2 parents ecf5d75 + de80d65 commit f0a9a83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/openlocationcode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def isFull(code):
208208
including any separator characters.
209209
"""
210210
def encode(latitude, longitude, codeLength=PAIR_CODE_LENGTH_):
211-
if codeLength < 2 or (codeLength < SEPARATOR_POSITION_ and codeLength % 2 == 1):
211+
if codeLength < 2 or (codeLength < PAIR_CODE_LENGTH_ and codeLength % 2 == 1):
212212
raise ValueError('Invalid Open Location Code length - ' + str(codeLength))
213213
# Ensure that latitude and longitude are valid.
214214
latitude = clipLatitude(latitude)

0 commit comments

Comments
 (0)