FIX: subscribing when manager is unset

One feature added to EventManager has been disconnecting
a participant at runtime. Unfortunatly, then the
manager of this participant is set to nullptr using
the setManager method. But this method also subscribes to the
shutdown event afterwords. This commit checks if the manager
is nullptr and ignore subscribing in that case.
This commit is contained in:
Dominik Meyer 2023-07-03 12:23:04 +02:00
parent 4f7f58a60c
commit 38c69d8da1
No known key found for this signature in database
GPG Key ID: B4C312B600606B64

View File

@ -181,7 +181,13 @@
*
* @param manager - the manager to set
*/
void setManager(std::shared_ptr<EventManager::Manager> manager) { manager_=manager;_subscribe(EVENT_TYPE_SHUTDOWN);}
void setManager(std::shared_ptr<EventManager::Manager> manager)
{ manager_=manager;
if (manager_!=nullptr)
{
_subscribe(EVENT_TYPE_SHUTDOWN);
}
}
/**
* @brief Method to set the unique id of the participant