additional safety by check against NO_QUEUE

This commit is contained in:
Robin Müller 2021-07-14 10:33:55 +02:00
parent 8f1a54aa19
commit f6d1b8981c
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -18,6 +18,10 @@ QueueMapManager* QueueMapManager::instance() {
ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) {
MutexGuard lock(mapLock); MutexGuard lock(mapLock);
uint32_t currentId = queueCounter++; uint32_t currentId = queueCounter++;
if(currentId == MessageQueueIF::NO_QUEUE) {
// Skip the NO_QUEUE value
queueCounter++;
}
auto returnPair = queueMap.emplace(currentId, queue); auto returnPair = queueMap.emplace(currentId, queue);
if(not returnPair.second) { if(not returnPair.second) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1