Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null check for our own member event #3082

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/webrtc/groupCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down