Skip to content

Commit

Permalink
room: allow RemoteParticipant to be None
Browse files Browse the repository at this point in the history
  • Loading branch information
nbsp committed Jul 6, 2024
1 parent cf1dc64 commit 5371f44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions livekit-rtc/livekit/rtc/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,16 @@ def _on_room_event(self, event: proto_room.RoomEvent):

def _retrieve_remote_participant(
self, sid: str, identity: str
) -> RemoteParticipant:
) -> Optional[RemoteParticipant]:
"""Retrieve a remote participant by sid or identity"""
participant = None
if identity:
participant = self.participants_by_identity[identity]
if not participant:
if not participant and sid in self.participants:
participant = self.participants[sid]
return participant

def _retrieve_participant(self, sid: str, identity: str) -> Participant:
def _retrieve_participant(self, sid: str, identity: str) -> Optional[Participant]:
"""Retrieve a participant by sid or identity,
returns the LocalParticipant if sid or identity matches"""
if identity and identity == self.local_participant.identity:
Expand Down

0 comments on commit 5371f44

Please sign in to comment.