mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Defensive coding
This commit is contained in:
@@ -56,7 +56,8 @@ class POTA(HTTPSpotProvider):
|
|||||||
# Now we need to look up the name of that reference from the API, because the comment won't have it
|
# Now we need to look up the name of that reference from the API, because the comment won't have it
|
||||||
park_response = self.PARK_DATA_CACHE.get(self.PARK_URL_ROOT + r.upper(), headers=HTTP_HEADERS)
|
park_response = self.PARK_DATA_CACHE.get(self.PARK_URL_ROOT + r.upper(), headers=HTTP_HEADERS)
|
||||||
park_data = park_response.json()
|
park_data = park_response.json()
|
||||||
spot.sig_refs_names.append(park_data["name"])
|
if park_data and "name" in park_data:
|
||||||
|
spot.sig_refs_names.append(park_data["name"])
|
||||||
|
|
||||||
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
||||||
# that for us.
|
# that for us.
|
||||||
|
|||||||
Reference in New Issue
Block a user