queue nullptr check in action helper #458
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "meier/ActionHelperQueueCheck"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I would suggest removing
setQueueToUse(MessageQueueIF* queue)
, when introducing thenullptr
check as it becomes mostly useless.@ -33,6 +33,17 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
setQueueToUse(queueToUse_);
As there is a check for nullptr in the following line, this if can be removed and
setQueueToUse(queueToUse_);
be moved to the end.@ -33,6 +33,17 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
setQueueToUse(queueToUse_);
}
if(queueToUse == nullptr) {
If
setQueueToUse(queueToUse_);
is moved to below this check,queueToUse_
needs to be checked instead ofqueueToUse
.queueToUse_
is allowed to be nullptr inActionHelper::initialize(MessageQueueIF* queueToUse_)
asqueueToUse
can be set in the constructor or by callingsetQueueToUse(xxx)
beforeinitialize
. Therefore, we need to check both as we have three cases:queueToUse
was set beforequeueToUse_
can be nullptr andsetQueueToUse(queueToUse_);
should not be calledqueueToUse
was not set beforequeueToUse_
is nullptr -> Error MessagequeueToUse_
is not a nullptr -> callsetQueueToUse(queueToUse_);