From df130e10f09ddb8fea3cc008ae310c75c214f9b3 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 2 Mar 2019 16:48:40 -0500 Subject: [PATCH] Prevent AttributeError when closing HTTPClient early. --- discord/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/discord/http.py b/discord/http.py index 3fb13591a..d098a0a48 100644 --- a/discord/http.py +++ b/discord/http.py @@ -230,7 +230,8 @@ class HTTPClient: # state management async def close(self): - await self._session.close() + if self._session: + await self._session.close() def _token(self, token, *, bot=True): self.token = token