From: Michael Tremer Date: Fri, 27 May 2022 09:41:39 +0000 (+0000) Subject: hub: Avoid any crashes when we received no message X-Git-Tag: 0.9.28~732 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2465b05c632db36d1169a52227529db2a2082d0f;p=pakfire.git hub: Avoid any crashes when we received no message The on_message callback can be called when the connection is closed which made the JSON decoder crash. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/hub.py b/src/pakfire/hub.py index 2afcaff0b..51d8df367 100644 --- a/src/pakfire/hub.py +++ b/src/pakfire/hub.py @@ -332,6 +332,10 @@ class Hub(object): It will then call the callback with the decoded message. """ + # Ignore empty messages + if message is None: + return + try: message = json.loads(message) except json.JSONDecodeError: