Skip to content

Commit fd8df25

Browse files
committed
Add out of bounds check to spike detector
1 parent b9d4eea commit fd8df25

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetector.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ void SpikeDetector::createSpikeChannels()
9090
Array<const DataChannel*> chans;
9191
for (int c = 0; c < nChans; c++)
9292
{
93-
chans.add(getDataChannel(elec->channels[c]));
93+
const DataChannel* ch = getDataChannel(elec->channels[c]);
94+
if (!ch)
95+
{
96+
//not enough channels for the electrodes
97+
return;
98+
}
99+
chans.add(ch);
94100
}
95101
SpikeChannel* spk = new SpikeChannel(SpikeChannel::typeFromNumChannels(nChans), this, chans);
96102
spk->setNumSamples(elec->prePeakSamples, elec->postPeakSamples);

0 commit comments

Comments
 (0)