From 817788383d78c15217c10c8859773c0fecaed410 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Thu, 22 Mar 2018 23:43:07 +0000 Subject: [PATCH] Clear bufferarray on error too --- discordbot/titanembeds/bot.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/discordbot/titanembeds/bot.py b/discordbot/titanembeds/bot.py index c526f92..dc8d71a 100644 --- a/discordbot/titanembeds/bot.py +++ b/discordbot/titanembeds/bot.py @@ -205,9 +205,13 @@ class Titan(discord.AutoShardedClient): if len(msg) >= 4: if msg[-4:] == b'\x00\x00\xff\xff': - msg = self.zlib_obj.decompress(self.buffer_arr) - msg = msg.decode('utf-8') - self.buffer_arr = bytearray() + try: + msg = self.zlib_obj.decompress(self.buffer_arr) + msg = msg.decode('utf-8') + except: + return + finally: + self.buffer_arr = bytearray() else: return else: