aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-02-26 00:33:29 +0100
committerGravatar Numerlor <[email protected]>2020-02-26 00:33:29 +0100
commite8e2fa9ee8f607bb6593b7c8325446dc074a972d (patch)
treee3e494fca77882adf9514f072b316758a2aed962
parentCheck for empty strings alongside None before loading cog. (diff)
Make sure token exists before checking its expiration.
Without the check and an invalid token, an AttributeError is raised; blocking the relevant ClientError from being raised in `get_access_token`.
-rw-r--r--bot/cogs/reddit.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py
index 7cb340145..982c0cbe6 100644
--- a/bot/cogs/reddit.py
+++ b/bot/cogs/reddit.py
@@ -43,7 +43,7 @@ class Reddit(Cog):
def cog_unload(self) -> None:
"""Stop the loop task and revoke the access token when the cog is unloaded."""
self.auto_poster_loop.cancel()
- if self.access_token.expires_at < datetime.utcnow():
+ if self.access_token and self.access_token.expires_at < datetime.utcnow():
self.revoke_access_token()
async def init_reddit_ready(self) -> None: