From 09f8ed82f68f6aa5796dc3f9f3b28ba73c436b98 Mon Sep 17 00:00:00 2001
From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es>
Date: Wed, 5 Nov 2014 01:51:25 +0100
Subject: [PATCH] Fix crash in LfpViewer when deleting source nodes

---
 Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp b/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp
index fef356715..287e9d426 100755
--- a/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp
+++ b/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp
@@ -948,7 +948,10 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
 
 channelType LfpDisplayCanvas::getChannelType(int n)
 {
-	return processor->channels[n]->getType();
+	if (n < processor->channels.size())
+		return processor->channels[n]->getType();
+	else
+		return DATA_CHANNEL;
 }
 
 channelType LfpDisplayCanvas::getSelectedType()
-- 
GitLab