Skip to content

Commit

Permalink
avoid KeyError in handle_disconnect (fixes #4304)
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Feb 11, 2025
1 parent 6f6ba0f commit 8352638
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nicegui/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ def handle_disconnect(self, socket_id: str) -> None:
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
Expand Down

0 comments on commit 8352638

Please sign in to comment.