Skip to content

Commit a591d86

Browse files
authored
Fix #1951: Do not crash if the 'alerts' key doesn't exist (#1953)
1 parent 57ada8e commit a591d86

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

debug_toolbar/panels/alerts.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ def __init__(self, *args, **kwargs):
8383

8484
@property
8585
def nav_subtitle(self):
86-
alerts = self.get_stats()["alerts"]
87-
if alerts:
86+
if alerts := self.get_stats().get("alerts"):
8887
alert_text = "alert" if len(alerts) == 1 else "alerts"
8988
return f"{len(alerts)} {alert_text}"
9089
else:

0 commit comments

Comments
 (0)