Check for outboundStreamOpts before accessing it

This method should be the same as the others in regards to checking for valid property.
It seems the extra logic for `isElectron` evaded the correct checking when calling from an incoming stream.

Error reported:
TypeError: Cannot read properties of undefined (reading 'publisherProperties')
```
pull/688/head
Flamenco 2022-01-25 12:49:23 -05:00 committed by GitHub
parent 3c1876769b
commit 75b88175cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -548,12 +548,15 @@ export class Stream {
* @hidden * @hidden
*/ */
isSendScreen(): boolean { isSendScreen(): boolean {
if (!this.outboundStreamOpts) {
return false;
}
let screen = this.outboundStreamOpts.publisherProperties.videoSource === 'screen'; let screen = this.outboundStreamOpts.publisherProperties.videoSource === 'screen';
if (platform.isElectron()) { if (platform.isElectron()) {
screen = typeof this.outboundStreamOpts.publisherProperties.videoSource === 'string' && screen = typeof this.outboundStreamOpts.publisherProperties.videoSource === 'string' &&
this.outboundStreamOpts.publisherProperties.videoSource.startsWith('screen:'); this.outboundStreamOpts.publisherProperties.videoSource.startsWith('screen:');
} }
return !!this.outboundStreamOpts && screen; return screen;
} }
/** /**