Skip to content

Commit 3be9844

Browse files
committed
Prevent LFPViewer from crashing on re-load if no channels coming in
1 parent 63e93e7 commit 3be9844

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Plugins/LfpDisplayNode/LfpDisplayOptions.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,9 @@ void LfpDisplayOptions::setAveraging(bool state)
956956

957957
void LfpDisplayOptions::setSortByDepth(bool state)
958958
{
959-
lfpDisplay->orderChannelsByDepth(state);
959+
960+
if (canvasSplit->displayBuffer != nullptr)
961+
lfpDisplay->orderChannelsByDepth(state);
960962

961963
sortByDepthButton->setToggleState(state, dontSendNotification);
962964

@@ -1563,7 +1565,8 @@ void LfpDisplayOptions::loadParameters(XmlElement* xml)
15631565
else
15641566
canvasSplit->displayBuffer = processor->displayBufferMap[id];
15651567

1566-
canvasSplit->displayBuffer->addDisplay(canvasSplit->splitID);
1568+
if (canvasSplit->displayBuffer != nullptr)
1569+
canvasSplit->displayBuffer->addDisplay(canvasSplit->splitID);
15671570

15681571
//std::cout << "Set to ID: " << canvasSplit->displayBuffer->id << std::endl;
15691572

@@ -1621,6 +1624,7 @@ void LfpDisplayOptions::loadParameters(XmlElement* xml)
16211624
}
16221625

16231626
// TOGGLE BUTTONS
1627+
16241628
setChannelsReversed(xmlNode->getBoolAttribute("reverseOrder", false));
16251629
setSortByDepth(xmlNode->getBoolAttribute("sortByDepth", false));
16261630
setShowChannelNumbers(xmlNode->getBoolAttribute("showChannelNum", false));

0 commit comments

Comments
 (0)