Add null check for our own member event

As per comment
This commit is contained in:
David Baker
2023-01-20 12:09:28 +00:00
parent c7210b9e9d
commit c019f2bb19
+8 -1
View File
@@ -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();