From 76bd1c89bf580ea0efcf8bd931482a2cad2b83f3 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 13 Sep 2021 18:45:49 +0200 Subject: [PATCH] Socket: Gracefully handle invalid lines with UTF8ONLY Just skip the line, instead of crashing the whole loop (which contains the next lines from the same server too) --- src/drivers/Socket.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/drivers/Socket.py b/src/drivers/Socket.py index d5d4ee5d8..f349c49af 100644 --- a/src/drivers/Socket.py +++ b/src/drivers/Socket.py @@ -216,7 +216,11 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin): and 'UTF8ONLY' in self.irc.state.supported: # No need for the fancy charset-guessing used in # decode_raw_line. - line = line.decode('utf8') + try: + line = line.decode('utf8') + except UnicodeError: + drivers.log.exception('Could not decode line %r', line) + continue else: line = decode_raw_line(line)