Guard uses of the keep alive thread in case they're None

Fixes #5800
This commit is contained in:
Rapptz 2020-09-09 21:18:41 -04:00
parent e6017a2170
commit f8808dba9b

View File

@ -398,10 +398,12 @@ class DiscordWebSocket:
raise ReconnectWebSocket(self.shard_id) raise ReconnectWebSocket(self.shard_id)
if op == self.HEARTBEAT_ACK: if op == self.HEARTBEAT_ACK:
if self._keep_alive:
self._keep_alive.ack() self._keep_alive.ack()
return return
if op == self.HEARTBEAT: if op == self.HEARTBEAT:
if self._keep_alive:
beat = self._keep_alive.get_payload() beat = self._keep_alive.get_payload()
await self.send_as_json(beat) await self.send_as_json(beat)
return return