aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2021-03-14 16:30:28 +0100
committerGravatar kwzrd <[email protected]>2021-03-14 20:58:16 +0100
commit8aacf079cf44259b88562bda0b9e78d43ba3fd68 (patch)
tree973a293638f6dede99d77017cef9086cf260bc5a
parentBranding: add embed length cut-offs for safety (diff)
Branding: check for empty icon cache
-rw-r--r--bot/exts/backend/branding/_cog.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/exts/backend/branding/_cog.py b/bot/exts/backend/branding/_cog.py
index 75d912530..43f0d742b 100644
--- a/bot/exts/backend/branding/_cog.py
+++ b/bot/exts/backend/branding/_cog.py
@@ -196,6 +196,10 @@ class Branding(commands.Cog):
state = await self.cache_icons.to_dict()
log.trace(f"Total icons in rotation: {len(state)}")
+ if not state: # This would only happen if rotation not initiated, but we can handle gracefully
+ log.warning("Attempted icon rotation with an empty icon cache!")
+ return False
+
if len(state) == 1 and 1 in state.values():
log.debug("Aborting icon rotation: only 1 icon is available and has already been applied")
return False