FixedTimeslotTask object check #10

Merged
gaisser merged 14 commits from KSat/fsfw:luz_FixedTimeslotTask_ExistenceCheck into master 2020-05-05 20:12:40 +02:00
Owner

Before adding to PST. Prevents NULL exception.

Before adding to PST. Prevents NULL exception.
Owner

I think we should write this as:

ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
	uint32_t slotTimeMs, int8_t executionStep) {
if (objectManager->get<ExecutableObjectIF>(componentId) != NULL) {
        pst.addSlot(componentId, slotTimeMs, executionStep, this);
    return HasReturnvaluesIF::RETURN_OK;
	
}
error << "Component " << std::hex << componentId << " not found, not adding it to pst" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
    }

This seems to be more clear about the intention.

I think we should write this as: ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { if (objectManager->get<ExecutableObjectIF>(componentId) != NULL) { pst.addSlot(componentId, slotTimeMs, executionStep, this); return HasReturnvaluesIF::RETURN_OK; } error << "Component " << std::hex << componentId << " not found, not adding it to pst" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } This seems to be more clear about the intention.
Author
Owner

Done

Done
Owner

Have you tested the code?

Have you tested the code?
gaisser closed this pull request 2020-03-20 14:23:18 +01:00
gaisser reopened this pull request 2020-03-20 14:23:21 +01:00
gaisser added the
bug
label 2020-03-20 15:19:19 +01:00
Author
Owner

Yes. Return error code if object does not exist instead of crashing with null pointer exception. Works fine otherwise.

Yes. Return error code if object does not exist instead of crashing with null pointer exception. Works fine otherwise.
Owner

I think we have to fix this for other OSAL versions as well

I think we have to fix this for other OSAL versions as well
gaisser self-assigned this 2020-05-05 11:47:10 +02:00
Author
Owner

I reported the changes to the other OSes.
However, linux and RTEMS are untested.

I reported the changes to the other OSes. However, linux and RTEMS are untested.
gaisser closed this pull request 2020-05-05 20:12:40 +02:00
gaisser deleted branch luz_FixedTimeslotTask_ExistenceCheck 2020-05-05 20:12:50 +02:00
Sign in to join this conversation.
No description provided.