openvidu-browser: protect onParticipantUnpublished upon undefined Connection.stream

pull/748/head
pabloFuente 2022-10-19 12:43:34 +02:00
parent 1ece085349
commit cc8ac8d99d
1 changed files with 6 additions and 5 deletions

View File

@ -904,11 +904,12 @@ export class Session extends EventDispatcher {
this.ee.emitEvent('streamDestroyed', [streamEvent]); this.ee.emitEvent('streamDestroyed', [streamEvent]);
streamEvent.callDefaultBehavior(); streamEvent.callDefaultBehavior();
// Deleting the remote stream // Deleting the remote stream if it exists
const streamId: string = connection.stream!.streamId; if (connection.stream != null) {
this.remoteStreamsCreated.delete(streamId); const streamId: string = connection.stream!.streamId;
this.remoteStreamsCreated.delete(streamId);
connection.removeStream(streamId); connection.removeStream(streamId);
}
}) })
.catch((openViduError) => { .catch((openViduError) => {
logger.error(openViduError); logger.error(openViduError);