diff --git a/src/webrtc/groupCall.ts b/src/webrtc/groupCall.ts index 27bc6e3e85e..f77145b3614 100644 --- a/src/webrtc/groupCall.ts +++ b/src/webrtc/groupCall.ts @@ -1182,6 +1182,14 @@ export class GroupCall extends TypedEventEmitter< * Recalculates and updates the participant map to match the room state. */ private updateParticipants(): void { + const localMember = this.room.getMember(this.client.getUserId()!)!; + if (!localMember) { + // The client hasn't fetched enough of the room state to get our own member + // event. This probably shouldn't happen, but sanity check & exit for now. + logger.warn("Tried to update participants before local room member is available"); + return; + } + if (this.participantsExpirationTimer !== null) { clearTimeout(this.participantsExpirationTimer); this.participantsExpirationTimer = null; @@ -1236,7 +1244,6 @@ export class GroupCall extends TypedEventEmitter< // Apply local echo for the entered case if (entered) { - const localMember = this.room.getMember(this.client.getUserId()!)!; let deviceMap = participants.get(localMember); if (deviceMap === undefined) { deviceMap = new Map();