From eb03f79978ef03af57b5de35130eb3625e6ffed8 Mon Sep 17 00:00:00 2001 From: Fritz Reichwald Date: Tue, 27 Dec 2016 22:51:30 +0100 Subject: [PATCH] Add error handling for UnicodeDecodeError --- qutebrowser/commands/userscripts.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 3c1d4d89e..4cd96ba02 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -65,9 +65,12 @@ class _QtFIFOReader(QObject): """(Try to) read a line from the FIFO.""" log.procs.debug("QSocketNotifier triggered!") self._notifier.setEnabled(False) - for line in self._fifo: - self.got_line.emit(line.rstrip('\r\n')) - self._notifier.setEnabled(True) + try: + for line in self._fifo: + self.got_line.emit(line.rstrip('\r\n')) + self._notifier.setEnabled(True) + except UnicodeDecodeError: + log.misc.error("Invalid unicode in userscript output") def cleanup(self): """Clean up so the FIFO can be closed."""