Skip to content

Commit

Permalink
Prevent crash while validating and error at the root
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoledoux committed Feb 3, 2021
1 parent 097d168 commit 6ba172e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cjio/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def validate_against_schema(j, js, longerr):
myvalidator = jsonschema.Draft7Validator(js, format_checker=jsonschema.FormatChecker())
for err in sorted(myvalidator.iter_errors(j), key=str):
isValid = False
if (longerr == False) and (err.relative_path[0] == 'CityObjects'):
if (longerr == False) and (len(err.relative_path) > 0) and (err.relative_path[0] == 'CityObjects'):
a = "CityObject is not schema-valid: " + err.relative_path[1]
es.append(a)
else:
Expand Down

0 comments on commit 6ba172e

Please sign in to comment.