From 991128a3e7dd006d31fa9c382ef355e8a0d7bad7 Mon Sep 17 00:00:00 2001 From: olzzon Date: Thu, 13 Jul 2023 12:32:58 +0200 Subject: [PATCH] fix: more optionals when no channels are assigned to a fader --- server/src/MainThreadHandler.ts | 2 +- server/src/utils/MixerConnection.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/src/MainThreadHandler.ts b/server/src/MainThreadHandler.ts index 3a35eba4..a603f9eb 100644 --- a/server/src/MainThreadHandler.ts +++ b/server/src/MainThreadHandler.ts @@ -56,7 +56,7 @@ export class MainThreadHandlers { faderIndex: faderIndex, state: state.faders[0].fader[faderIndex], }) - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (channel: IChannelReference) => { socketServer.emit(IO.SOCKET_SET_STORE_CHANNEL, { channelIndex: channel.channelIndex, diff --git a/server/src/utils/MixerConnection.ts b/server/src/utils/MixerConnection.ts index b59881e0..e8ba3ae8 100644 --- a/server/src/utils/MixerConnection.ts +++ b/server/src/utils/MixerConnection.ts @@ -202,7 +202,7 @@ export class MixerGenericConnection { } - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (assignedChannel: IChannelReference) => { if (assignedChannel.mixerIndex !== mixerIndexToSkip) { this.fadeInOut( @@ -225,7 +225,7 @@ export class MixerGenericConnection { updateInputGain = (faderIndex: number) => { let level = state.faders[0].fader[faderIndex].inputGain - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (assignedChannel: IChannelReference) => { this.mixerConnection[assignedChannel.mixerIndex].updateInputGain( assignedChannel.channelIndex, @@ -238,7 +238,7 @@ export class MixerGenericConnection { updateInputSelector = (faderIndex: number) => { let inputSelected = state.faders[0].fader[faderIndex].inputSelector logger.trace(`${faderIndex} ${inputSelected}`) - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (assignedChannel: IChannelReference) => { this.mixerConnection[assignedChannel.mixerIndex].updateInputSelector( assignedChannel.channelIndex, @@ -253,7 +253,7 @@ export class MixerGenericConnection { } updateMuteState = (faderIndex: number, mixerIndexToSkip: number = -1) => { - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (assignedChannel: IChannelReference) => { if (assignedChannel.mixerIndex !== mixerIndexToSkip) { this.mixerConnection[assignedChannel.mixerIndex].updateMuteState( @@ -266,7 +266,7 @@ export class MixerGenericConnection { } updateAMixState = (faderIndex: number) => { - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (assignedChannel: IChannelReference) => { this.mixerConnection[assignedChannel.mixerIndex].updateAMixState( assignedChannel.channelIndex, @@ -286,7 +286,7 @@ export class MixerGenericConnection { (100 - state.settings[0].voLevel)) / 100 } - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (assignedChannel: IChannelReference) => { this.mixerConnection[assignedChannel.mixerIndex].updateNextAux( assignedChannel.channelIndex, @@ -298,7 +298,7 @@ export class MixerGenericConnection { updateFx = (fxParam: fxParamsList, faderIndex: number) => { let level: number = state.faders[0].fader[faderIndex][fxParam][0] - state.faders[0].fader[faderIndex].assignedChannels.forEach( + state.faders[0].fader[faderIndex].assignedChannels?.forEach( (assignedChannel: IChannelReference) => { this.mixerConnection[assignedChannel.mixerIndex].updateFx( fxParam,