Clear bufferarray on error too

This commit is contained in:
Jeremy Zhang 2018-03-22 23:43:07 +00:00
parent 731b47e978
commit 817788383d

View File

@ -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: