Defensive coding

This commit is contained in:
Ian Renton
2026-08-15 07:11:36 +01:00
parent ef2c23c8b6
commit 0dee8d827a
9 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -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