mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
Defensive coding
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user