From 2ab475169e8c32b6b4380a1225a654dac83062f7 Mon Sep 17 00:00:00 2001
From: athatheocsd <athatheo@csd.auth.gr>
Date: Wed, 9 Jan 2019 21:08:04 +0200
Subject: [PATCH] Fixed cpp check and added todo for an error handler

---
 inc/ErrorHandler.hpp                | 1 -
 src/Services/EventActionService.cpp | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/inc/ErrorHandler.hpp b/inc/ErrorHandler.hpp
index adffdc13..95c9138e 100644
--- a/inc/ErrorHandler.hpp
+++ b/inc/ErrorHandler.hpp
@@ -51,7 +51,6 @@ public:
 		 * A string is larger than the largest allowed string
 		 */
 			StringTooLarge = 4,
-
 		/**
 		 * An error in the header of a packet makes it unable to be parsed
 		 */
diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp
index 63f3e9f1..5938837c 100644
--- a/src/Services/EventActionService.cpp
+++ b/src/Services/EventActionService.cpp
@@ -13,12 +13,12 @@ void EventActionService::addEventActionDefinitions(Message message) {
 	                                                                     19) {
 		uint16_t index;
 		for (index = 0; index < ECSS_EVENT_ACTION_STRUCT_ARRAY_SIZE; index++) {
+			// @todo: throw an error if it's full
 			if (eventActionDefinitionArray[index].empty == true) {
 				break;
 			}
 		}
 		if (index < ECSS_EVENT_ACTION_STRUCT_ARRAY_SIZE) {
-			char data[ECSS_EVENT_SERVICE_STRING_SIZE];
 			eventActionDefinitionArray[index].empty = false;
 			eventActionDefinitionArray[index].enabled = true;
 			eventActionDefinitionArray[index].applicationId = message.readEnum16();
@@ -28,6 +28,7 @@ void EventActionService::addEventActionDefinitions(Message message) {
 			if (message.dataSize - 4 > ECSS_EVENT_SERVICE_STRING_SIZE) { // Should this be >= ?
 				ErrorHandler::reportInternalError(ErrorHandler::InternalErrorType::MessageTooLarge);
 			} else {
+				char data[ECSS_EVENT_SERVICE_STRING_SIZE];
 				message.readString(data, message.dataSize);
 				eventActionDefinitionArray[index].request = String<ECSS_EVENT_SERVICE_STRING_SIZE>(
 					data);
-- 
GitLab