getWritePionter for multichannel audio

Hi I’m building a delay for audio with 4 channels, but when I want to getWritePointer of each channels it appears this error and the DAW crashes.

com.apple.audio.IOThread.client (16): EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

float* xChannel = buffer.getWritePointer(1);
float* yChannel = buffer.getWritePointer(2);
float* zChannel = buffer.getWritePointer(3);

This is what I code on tha processblock function.

You should check beforehand, if the plugin is actually running with >=4 channels, and have a strategy in place if that is not the case.
My strong hunch is, that the buffer has less channels than you assumed.

Check buffer.getNumChannels()