From 8aacf079cf44259b88562bda0b9e78d43ba3fd68 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sun, 14 Mar 2021 16:30:28 +0100 Subject: Branding: check for empty icon cache --- bot/exts/backend/branding/_cog.py | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3