From 7d492d7556f0b66772c39119195cb2f5d4fcea5d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 13 Oct 2014 21:16:38 +0200 Subject: [PATCH] Ignore invalid json data. --- qutebrowser/utils/ipc.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qutebrowser/utils/ipc.py b/qutebrowser/utils/ipc.py index e55cab076..70541736c 100644 --- a/qutebrowser/utils/ipc.py +++ b/qutebrowser/utils/ipc.py @@ -97,9 +97,14 @@ class IPCServer(QObject): """Read json data from the client.""" while self._socket.canReadLine(): data = bytes(self._socket.readLine()) - args = json.loads(data.decode('utf-8')) - app = objreg.get('app') - app.process_args(args) + decoded = data.decode('utf-8') + try: + args = json.loads(decoded) + except ValueError: + return + else: + app = objreg.get('app') + app.process_args(args) def shutdown(self): """Shut down the IPC server cleanly."""