From 5b841f8f59ceec3876308aef7ff03b620f7457d2 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sun, 21 Jul 2024 00:35:21 -0700 Subject: [PATCH] fix out of bounds tides thanks @Hailo1999 for pointing this out. ref:https://github.com/SpudGunMan/meshing-around/issues/20 --- modules/locationdata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/locationdata.py b/modules/locationdata.py index 1bb50ba..42c293e 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -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