additional nullptr checks

This commit is contained in:
Robin Müller 2021-01-27 20:04:16 +01:00
parent a0e7b45d94
commit 73dcb78a65
2 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#include "ObjectManager.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../serviceinterface/ServiceInterface.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1
#include <iomanip>
@ -75,6 +75,8 @@ void ObjectManager::initialize() {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectManager::initialize: Passed produceObjects "
"functions is nullptr!" << std::endl;
#else
sif::printError("ObjectManager::initialize: Passed produceObjects functions is nullptr!\n");
#endif
return;
}

View File

@ -5,13 +5,17 @@
SystemObject::SystemObject(object_id_t setObjectId, bool doRegister) :
objectId(setObjectId), registered(doRegister) {
if (registered) {
objectManager->insert(objectId, this);
if(objectManager != nullptr) {
objectManager->insert(objectId, this);
}
}
}
SystemObject::~SystemObject() {
if (registered) {
objectManager->remove(objectId);
if(objectManager != nullptr) {
objectManager->remove(objectId);
}
}
}