mapillary / mapillary-python-sdk

A Python 3 library built on the Mapillary API v4 to facilitate retrieving and working with Mapillary data.
MIT License
37 stars 14 forks source link

Fix a crash in get_image_close_to when a tile has no features #140

Closed tijszwinkels closed 2 years ago

tijszwinkels commented 2 years ago

Tiny bugfix; When calling get_image_close_to, the library would crash when the received tile was empty, with a message like this:

  File "/usr/local/lib/python3.9/site-packages/mapillary/utils/auth.py", line 59, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mapillary/interface.py", line 110, in get_image_close_to
    return image.get_image_close_to_controller(
  File "/usr/local/lib/python3.9/site-packages/mapillary/controller/image.py", line 134, in get_image_close_to_controller
    and unfiltered_data["features"][0]["properties"] != {}
IndexError: list index out of range

this MR fixes this crash.

tijszwinkels commented 2 years ago

Build failed on building documentation, but no documentation changed. Failing check is unrelated.

Rubix982 commented 2 years ago

Thanks for the PR, @tijszwinkels.

Sure, this is an easy merge.

The documentation workflow fails if no part of the documentation is altered, hence the fail signals that there needs nothing to be done. The documentation is generated from the source code (.py) files. So the fail is okay and can be disregarded.