From 00ee891952b68cd8ed206e1d8ccd7e3330353320 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 22 Sep 2018 02:49:06 -0500 Subject: [PATCH] Prevent error in monitor Put in place try/except in case data is None --- resources/lib/monitor.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/resources/lib/monitor.py b/resources/lib/monitor.py index 51d07ee8..b3980b6c 100644 --- a/resources/lib/monitor.py +++ b/resources/lib/monitor.py @@ -66,19 +66,26 @@ class Monitor(xbmc.Monitor): data = json.loads(data) - if method != 'LoadServer' and data.get('ServerId') and data['ServerId'] not in self.servers: + LOG.info("[ %s: %s ] %s", sender, method, json.dumps(data, indent=4)) - try: - connect.Connect().register(data['ServerId']) - self.server_instance(data['ServerId']) - except Exception as error: + try: + if method != 'LoadServer' and data.get('ServerId') and data['ServerId'] not in self.servers: - LOG.error(error) - dialog("ok", heading="{emby}", line1=_(33142)) + try: + connect.Connect().register(data['ServerId']) + self.server_instance(data['ServerId']) + except Exception as error: - return + LOG.error(error) + dialog("ok", heading="{emby}", line1=_(33142)) - server = Emby(data.get('ServerId')) + return + + server = Emby(data.get('ServerId')) + except Exception as error: + + LOG.error(error) + server = Emby() if method == 'GetItem':