openvidu-browser: Avoided accessing to a property of null

pull/803/head
Carlos Santos 2023-05-05 10:29:39 +02:00
parent 4e50796547
commit 90acd8682c
1 changed files with 2 additions and 2 deletions

View File

@ -992,8 +992,8 @@ export class Session extends EventDispatcher {
oldValue = stream.videoActive;
event.newValue = event.newValue === 'true';
stream.videoActive = event.newValue;
const videoTrack = stream.getMediaStream().getVideoTracks()[0];
if(!videoTrack.enabled && stream.videoActive){
const videoTrack = stream?.getMediaStream()?.getVideoTracks()?.[0];
if(videoTrack && !videoTrack.enabled && stream.videoActive){
videoTrack.enabled = true;
}
break;