Commits

Anonymous committed 823795c

MTConnectors : corrected bug when eeg data is called and connector is not connected

  • Participants
  • Parent commits 741093d

Comments (0)

Files changed (1)

thinkgear/MTConnector.hx

 			JSONConnector.getData();
 
 			var eeg = JSONConnector.eeg;
-			shared.poorSignalLevel = eeg.poorSignalLevel;
-			shared.delta = eeg.eegPower.delta;
-			shared.theta = eeg.eegPower.theta;
-			shared.lowAlpha = eeg.eegPower.lowAlpha;
-			shared.highAlpha = eeg.eegPower.highAlpha;
-			shared.lowBeta = eeg.eegPower.lowBeta;
-			shared.highBeta = eeg.eegPower.highBeta;
-			shared.lowGamma = eeg.eegPower.lowGamma;
-			shared.highGamma = eeg.eegPower.highGamma;
-			shared.attention = eeg.eSense.attention;
-			shared.meditation = eeg.eSense.meditation;
-			shared.blinkStrength = JSONConnector.blinkStrength;
+			if( eeg != null ) {
+				shared.poorSignalLevel = eeg.poorSignalLevel;
+				shared.delta = eeg.eegPower.delta;
+				shared.theta = eeg.eegPower.theta;
+				shared.lowAlpha = eeg.eegPower.lowAlpha;
+				shared.highAlpha = eeg.eegPower.highAlpha;
+				shared.lowBeta = eeg.eegPower.lowBeta;
+				shared.highBeta = eeg.eegPower.highBeta;
+				shared.lowGamma = eeg.eegPower.lowGamma;
+				shared.highGamma = eeg.eegPower.highGamma;
+				shared.attention = eeg.eSense.attention;
+				shared.meditation = eeg.eSense.meditation;
+				shared.blinkStrength = JSONConnector.blinkStrength;
+			}
 		}		
 	}