diff --git a/client/utils/SocketClientHandlers.ts b/client/utils/SocketClientHandlers.ts index 03781247..a989c58c 100644 --- a/client/utils/SocketClientHandlers.ts +++ b/client/utils/SocketClientHandlers.ts @@ -99,9 +99,11 @@ export const socketClientHandlers = () => { ) }) .on(SOCKET_SET_STORE_FADER, (payload: any) => { - window.storeRedux.dispatch( - storeSetSingleFaderState(payload.faderIndex, payload.state) - ) + if ('faderIndex' in payload && 'state' in payload) { + window.storeRedux.dispatch( + storeSetSingleFaderState(payload.faderIndex, payload.state) + ) + } }) .on(SOCKET_SET_STORE_CHANNEL, (payload: any) => { window.storeRedux.dispatch( diff --git a/server/reducers/fadersReducer.ts b/server/reducers/fadersReducer.ts index a515f196..aa9fef40 100644 --- a/server/reducers/fadersReducer.ts +++ b/server/reducers/fadersReducer.ts @@ -123,7 +123,10 @@ export const faders = ( fader: [...state[0].fader], }, ] - if (action.channel > nextState[0].fader.length) { + if ( + action.channel && + (action.channel < 0 || action.channel >= nextState[0].fader.length) + ) { return nextState } diff --git a/server/utils/AutomationConnection.ts b/server/utils/AutomationConnection.ts index cd432f7f..dc4275bb 100644 --- a/server/utils/AutomationConnection.ts +++ b/server/utils/AutomationConnection.ts @@ -71,7 +71,10 @@ export class AutomationConnection { ) ) { let ch = message.address.split('/')[2] - if (!state.faders[0].fader[ch - 1].ignoreAutomation) { + if ( + state.faders[0].fader[ch - 1] && + !state.faders[0].fader[ch - 1].ignoreAutomation + ) { if (message.args[0] === 1) { mixerGenericConnection.checkForAutoResetThreshold( ch - 1 @@ -104,7 +107,10 @@ export class AutomationConnection { ) ) { let ch = message.address.split('/')[2] - if (!state.faders[0].fader[ch - 1].ignoreAutomation) { + if ( + state.faders[0].fader[ch - 1] && + !state.faders[0].fader[ch - 1].ignoreAutomation + ) { if (message.args[0] === 1) { store.dispatch(storeSetPst(ch - 1, true)) } else if (message.args[0] === 2) { @@ -122,7 +128,10 @@ export class AutomationConnection { ) ) { let ch = message.address.split('/')[2] - if (!state.faders[0].fader[ch - 1].ignoreAutomation) { + if ( + state.faders[0].fader[ch - 1] && + !state.faders[0].fader[ch - 1].ignoreAutomation + ) { store.dispatch( storeSetMute(ch - 1, message.args[0] === 1) ) @@ -137,7 +146,10 @@ export class AutomationConnection { ) ) { let ch = message.address.split('/')[2] - if (!state.faders[0].fader[ch - 1].ignoreAutomation) { + if ( + state.faders[0].fader[ch - 1] && + !state.faders[0].fader[ch - 1].ignoreAutomation + ) { store.dispatch( storeFaderLevel(ch - 1, message.args[0]) )