File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -501,10 +501,16 @@ export class GroupCall extends EventEmitter {
501501 const localUserId = this . client . getUserId ( ) ;
502502
503503 const currentStateEvent = this . room . currentState . getStateEvents ( EventType . GroupCallMemberPrefix , localUserId ) ;
504+ const memberStateEvent = currentStateEvent ?. getContent < IGroupCallRoomMemberState > ( ) ;
504505
505- const calls = currentStateEvent ?. getContent < IGroupCallRoomMemberState > ( ) [ "m.calls" ] || [ ] ;
506-
507- const existingCallIndex = calls . findIndex ( ( call ) => call [ "m.call_id" ] === this . groupCallId ) ;
506+ let calls : IGroupCallRoomMemberCallState [ ] = [ ] ;
507+ let existingCallIndex : number ;
508+ if ( memberCallState ) {
509+ calls = memberStateEvent [ "m.calls" ] || [ ] ;
510+ existingCallIndex = calls . findIndex ( ( call ) => call && call [ "m.call_id" ] === this . groupCallId ) ;
511+ } else {
512+ existingCallIndex = 0 ;
513+ }
508514
509515 if ( existingCallIndex === - 1 ) {
510516 calls . push ( memberCallState ) ;
You can’t perform that action at this time.
0 commit comments