Skip to content

Commit c019f2b

Browse files
committed
Add null check for our own member event
As per comment
1 parent c7210b9 commit c019f2b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/webrtc/groupCall.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,14 @@ export class GroupCall extends TypedEventEmitter<
11821182
* Recalculates and updates the participant map to match the room state.
11831183
*/
11841184
private updateParticipants(): void {
1185+
const localMember = this.room.getMember(this.client.getUserId()!)!;
1186+
if (!localMember) {
1187+
// The client hasn't fetched enough of the room state to get our own member
1188+
// event. This probably shouldn't happen, but sanity check & exit for now.
1189+
logger.warn("Tried to update participants before local room member is available");
1190+
return;
1191+
}
1192+
11851193
if (this.participantsExpirationTimer !== null) {
11861194
clearTimeout(this.participantsExpirationTimer);
11871195
this.participantsExpirationTimer = null;
@@ -1236,7 +1244,6 @@ export class GroupCall extends TypedEventEmitter<
12361244

12371245
// Apply local echo for the entered case
12381246
if (entered) {
1239-
const localMember = this.room.getMember(this.client.getUserId()!)!;
12401247
let deviceMap = participants.get(localMember);
12411248
if (deviceMap === undefined) {
12421249
deviceMap = new Map();

0 commit comments

Comments
 (0)