plugin: nwc: handle 'null' params in request

Some clients send 'params: null' instead of 'params: {}' or no
params key at all.
This commit is contained in:
f321x
2026-04-07 09:52:13 +02:00
parent 7a6a39d1aa
commit fd230cf9d1
+2 -2
View File
@@ -344,9 +344,9 @@ class NWCServer(Logger, EventListener):
content = json.loads(content)
if not isinstance(content, dict):
raise Exception("malformed content, not dict")
params: dict = content.get('params', {})
params: dict = content.get('params') or {} # some clients send 'params: null' or no params key at all
if not isinstance(params, dict):
raise Exception("malformed params, not dict")
raise Exception(f"malformed params, not dict: {content=}")
except Exception:
self.logger.debug(f"Invalid request event content: {event.content}", exc_info=True)
continue