From 0dee8d827aed89cf5bfac1dddbe11c82001a35e9 Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Sat, 15 Aug 2026 07:11:36 +0100 Subject: [PATCH] Defensive coding --- core/cleanup.py | 4 ++-- templates/add_spot.html | 2 +- templates/alerts.html | 2 +- templates/bands.html | 4 ++-- templates/base.html | 10 +++++----- templates/conditions.html | 2 +- templates/map.html | 4 ++-- templates/spots.html | 4 ++-- templates/status.html | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/cleanup.py b/core/cleanup.py index 800b582..4238fd7 100644 --- a/core/cleanup.py +++ b/core/cleanup.py @@ -44,7 +44,7 @@ class CleanupTimer: for i in list(DATA_STORE.spots.keys()): try: spot = DATA_STORE.spots.get(i) - if spot.expired(): + if spot and spot.expired(): DATA_STORE.spots.delete(i) except KeyError: # Must have already been deleted, OK with that @@ -52,7 +52,7 @@ class CleanupTimer: for i in list(DATA_STORE.alerts.keys()): try: alert = DATA_STORE.alerts.get(i) - if alert.expired(): + if alert and alert.expired(): DATA_STORE.alerts.delete(i) except KeyError: # Must have already been deleted, OK with that diff --git a/templates/add_spot.html b/templates/add_spot.html index 2b5ef36..8f13ea9 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -76,7 +76,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index 31b429c..f8d6d79 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -82,7 +82,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index c2cbb90..066ad03 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -79,8 +79,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 45320bf..a60793c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -15,10 +15,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index 8b8ec4b..83233ae 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index b2882b5..b955643 100644 --- a/templates/map.html +++ b/templates/map.html @@ -112,8 +112,8 @@ - - + + diff --git a/templates/spots.html b/templates/spots.html index b9721fb..a5ffd30 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -118,8 +118,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index 68e3147..e8750b6 100644 --- a/templates/status.html +++ b/templates/status.html @@ -86,7 +86,7 @@ - +