瀏覽代碼

handle `undefined` in event args

Falko Schindler 1 年之前
父節點
當前提交
73f3837528
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      nicegui/nicegui.py

+ 1 - 1
nicegui/nicegui.py

@@ -173,7 +173,7 @@ def handle_event(client: Client, msg: Dict) -> None:
     with client:
     with client:
         sender = client.elements.get(msg['id'])
         sender = client.elements.get(msg['id'])
         if sender:
         if sender:
-            msg['args'] = [json.loads(arg) for arg in msg.get('args', [])]
+            msg['args'] = [None if arg is None else json.loads(arg) for arg in msg.get('args', [])]
             if len(msg['args']) == 1:
             if len(msg['args']) == 1:
                 msg['args'] = msg['args'][0]
                 msg['args'] = msg['args'][0]
             sender._handle_event(msg)
             sender._handle_event(msg)