diff --git a/CHANGELOG.md b/CHANGELOG.md index d1ba1cf88c..b31e2a492a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,6 +111,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2779](https://github.com/Pycord-Development/pycord/pull/2779)) - Fixed GIF-based `Sticker` returning the wrong `url`. ([#2781](https://github.com/Pycord-Development/pycord/pull/2781)) +- Fixed `VoiceClient` crashing randomly while receiving audio + ([#2800](https://github.com/Pycord-Development/pycord/pull/2800)) ### Changed diff --git a/discord/voice_client.py b/discord/voice_client.py index 4ba571c9a7..75902ecbe2 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -613,7 +613,7 @@ def _decrypt_xsalsa20_poly1305_lite(self, header, data): @staticmethod def strip_header_ext(data): - if data[0] == 0xBE and data[1] == 0xDE and len(data) > 4: + if len(data) > 4 and data[0] == 0xBE and data[1] == 0xDE: _, length = struct.unpack_from(">HH", data) offset = 4 + length * 4 data = data[offset:]