Parcourir la source

avoid `KeyError` in `handle_disconnect` (fixes #4304)

Falko Schindler il y a 3 mois
Parent
commit
8352638efc
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      nicegui/client.py

+ 2 - 0
nicegui/client.py

@@ -257,6 +257,8 @@ class Client:
         In contrast to connect handlers, disconnect handlers are not called during a reconnect.
         This behavior should be fixed in version 3.0.
         """
+        if socket_id not in self._socket_to_document_id:
+            return
         document_id = self._socket_to_document_id.pop(socket_id)
         self._cancel_delete_task(document_id)
         self._num_connections[document_id] -= 1