fix out of bounds tides

thanks @Hailo1999 for pointing this out.
ref:https://github.com/SpudGunMan/meshing-around/issues/20
This commit is contained in:
SpudGunMan
2024-07-21 00:35:21 -07:00
parent 9fdd789f80
commit 5b841f8f59
+3 -3
View File
@@ -45,10 +45,10 @@ def get_tide(lat=0, lon=0):
else:
return ERROR_FETCHING_DATA
station_id = station_json['stationList'][0]['stationId']
if station_id is None:
if station_json['stationList'] == [] or station_json['stationList'] is None:
return "no station found"
station_id = station_json['stationList'][0]['stationId']
except (requests.exceptions.RequestException, json.JSONDecodeError):
return ERROR_FETCHING_DATA