Skip to content

Commit 64197bf

Browse files
authored
Merge pull request #3082 from matrix-org/dbkr/ptt_null_member_workarounds
Add null check for our own member event
2 parents c309fe6 + c019f2b commit 64197bf

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
@@ -1188,6 +1188,14 @@ export class GroupCall extends TypedEventEmitter<
11881188
* Recalculates and updates the participant map to match the room state.
11891189
*/
11901190
private updateParticipants(): void {
1191+
const localMember = this.room.getMember(this.client.getUserId()!)!;
1192+
if (!localMember) {
1193+
// The client hasn't fetched enough of the room state to get our own member
1194+
// event. This probably shouldn't happen, but sanity check & exit for now.
1195+
logger.warn("Tried to update participants before local room member is available");
1196+
return;
1197+
}
1198+
11911199
if (this.participantsExpirationTimer !== null) {
11921200
clearTimeout(this.participantsExpirationTimer);
11931201
this.participantsExpirationTimer = null;
@@ -1242,7 +1250,6 @@ export class GroupCall extends TypedEventEmitter<
12421250

12431251
// Apply local echo for the entered case
12441252
if (entered) {
1245-
const localMember = this.room.getMember(this.client.getUserId()!)!;
12461253
let deviceMap = participants.get(localMember);
12471254
if (deviceMap === undefined) {
12481255
deviceMap = new Map();

0 commit comments

Comments
 (0)