Error when filtering sidechain buffer

Hey, so I’m trying to implement a sidechain multiband functionality to my plugin.

I have set up my main and sidechain busses as follows in the first lines of process block:

auto mainInputOutput = getBusBuffer (buffer, true, 0);
auto sideChainInput  = getBusBuffer (buffer, true, 1);

but my debugging points to an error caused by a later line in process block:

lowBandFilterL1.processSamples(sideChainInput.getWritePointer(0), numSamples);

When I replace sideChainInput with mainInputOutput in the above code the error goes away and the filter works. I suspect that it’s because the sidechain bus is not used initially, so if it’s empty the filter won’t be able to process it. If that is the case I’m thinking to use an if statement to check if the sidechain is empty, but how would I do that? ( i can’t simply do sideChainInput == 0 )