diff options
| author | Riley Shaw <[email protected]> | 2021-02-18 11:53:08 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-18 06:53:08 -0500 |
| commit | fafc3d91854d4db615637344593c6979a12fa375 (patch) | |
| tree | 2dd61f5e46d3c9b17541c0e6b1897aa75740bde4 | |
| parent | Allow CustomActivity emoji to be constructed as documented. (diff) | |
| download | discord.py-fafc3d91854d4db615637344593c6979a12fa375.tar.xz discord.py-fafc3d91854d4db615637344593c6979a12fa375.zip | |
Fix ZeroDivisionError in DiscordVoiceWebSocket.average_latency
| -rw-r--r-- | discord/gateway.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 9b85b866..f13276a1 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -876,7 +876,7 @@ class DiscordVoiceWebSocket: def average_latency(self): """:class:`list`: Average of last 20 HEARTBEAT latencies.""" heartbeat = self._keep_alive - if heartbeat is None: + if heartbeat is None or not heartbeat.recent_ack_latencies: return float('inf') return sum(heartbeat.recent_ack_latencies) / len(heartbeat.recent_ack_latencies) |