Skip to content

Commit 8352638

Browse files
avoid KeyError in handle_disconnect (fixes #4304)
1 parent 6f6ba0f commit 8352638

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

nicegui/client.py

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ def handle_disconnect(self, socket_id: str) -> None:
257257
In contrast to connect handlers, disconnect handlers are not called during a reconnect.
258258
This behavior should be fixed in version 3.0.
259259
"""
260+
if socket_id not in self._socket_to_document_id:
261+
return
260262
document_id = self._socket_to_document_id.pop(socket_id)
261263
self._cancel_delete_task(document_id)
262264
self._num_connections[document_id] -= 1

0 commit comments

Comments
 (0)