Skip to content

Commit

Permalink
Fix #1951: Do not crash if the 'alerts' key doesn't exist (#1953)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask authored Jul 5, 2024
1 parent 57ada8e commit a591d86
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions debug_toolbar/panels/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def __init__(self, *args, **kwargs):

@property
def nav_subtitle(self):
alerts = self.get_stats()["alerts"]
if alerts:
if alerts := self.get_stats().get("alerts"):
alert_text = "alert" if len(alerts) == 1 else "alerts"
return f"{len(alerts)} {alert_text}"
else:
Expand Down

0 comments on commit a591d86

Please sign in to comment.