Skip to content
Snippets Groups Projects
Commit 8d9b08e4 authored by Aaron Cuevas Lopez's avatar Aaron Cuevas Lopez
Browse files

Fix sorter crashing when removing source processor

parent 8352891b
No related branches found
No related tags found
No related merge requests found
......@@ -172,6 +172,7 @@ void SpikeSorter::updateSettings()
{
mut.enter();
sorterReady = false;
int numChannels = getNumInputs();
if (numChannels > 0)
overflowBuffer.setSize(getNumInputs(), overflowBufferSize);
......@@ -191,7 +192,13 @@ void SpikeSorter::updateSettings()
Array<const DataChannel*> chans;
for (int c = 0; c < nChans; c++)
{
chans.add(getDataChannel(elec->channels[c]));
const DataChannel* ch = getDataChannel(elec->channels[c]);
if (!ch)
{
//not enough channels for the electrodes
return;
}
chans.add(ch);
}
SpikeChannel* spk = new SpikeChannel(SpikeChannel::typeFromNumChannels(nChans), this, chans);
......@@ -200,7 +207,7 @@ void SpikeSorter::updateSettings()
spikeChannelArray.add(spk);
}
sorterReady = true;
mut.exit();
}
......@@ -647,6 +654,12 @@ bool SpikeSorter::enable()
{
useOverflowBuffer.clear();
if (!sorterReady)
{
CoreServices::sendStatusMessage("Not enough channels for the configured electrodes");
std::cout << "SpikeSorter: Not enough channels for the configured electrodes" << std::endl;
return false;
}
for (int i = 0; i < electrodes.size(); i++)
useOverflowBuffer.add(false);
......
......@@ -427,6 +427,8 @@ private:
// RHD2000Thread* getRhythmAccess();
bool flipSignal;
bool sorterReady{ false };
Time timer;
void addWaveformToSpikeObject(SpikeEvent::SpikeBuffer& s,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment