queueToUse_ is allowed to be nullptr in ActionHelper::initialize(MessageQueueIF* queueToUse_) as queueToUse can be set in the constructor or by calling setQueueToUse(xxx) before initialize. Therefore, we need to check both as we have three cases:
queueToUse was set before
queueToUse_ can be nullptr and setQueueToUse(queueToUse_); should not be called
queueToUse was not set before
queueToUse_ is nullptr -> Error Message
queueToUse_ is not a nullptr -> call setQueueToUse(queueToUse_);
``queueToUse_`` is allowed to be nullptr in `` ActionHelper::initialize(MessageQueueIF* queueToUse_)`` as ``queueToUse`` can be set in the constructor or by calling ``setQueueToUse(xxx)`` before ``initialize``. Therefore, we need to check both as we have three cases:
1. ``queueToUse`` was set before
1. ``queueToUse_`` can be nullptr and `` setQueueToUse(queueToUse_); `` should not be called
2. ``queueToUse`` was not set before
1. ``queueToUse_`` is nullptr -> Error Message
2. ``queueToUse_`` is not a nullptr -> call `` setQueueToUse(queueToUse_); ``
mohr
was assigned by gaisser2021-08-16 14:41:53 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I would suggest removing
setQueueToUse(MessageQueueIF* queue), when introducing thenullptrcheck 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_)asqueueToUsecan be set in the constructor or by callingsetQueueToUse(xxx)beforeinitialize. Therefore, we need to check both as we have three cases:queueToUsewas set beforequeueToUse_can be nullptr andsetQueueToUse(queueToUse_);should not be calledqueueToUsewas not set beforequeueToUse_is nullptr -> Error MessagequeueToUse_is not a nullptr -> callsetQueueToUse(queueToUse_);