Skip to content

Commit a5f27e8

Browse files
author
Jacob Hageman
committed
Fix #2040, Improve CFE_SB_IsValidMsgId handler
If no return value override is set test against CFE_SB_INVALID_MSG_ID
1 parent 07fb348 commit a5f27e8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

modules/core_api/ut-stubs/src/cfe_sb_handlers.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,19 @@ void UT_DefaultHandler_CFE_SB_GetUserDataLength(void *UserObj, UT_EntryKey_t Fun
398398
*------------------------------------------------------------*/
399399
void UT_DefaultHandler_CFE_SB_IsValidMsgId(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)
400400
{
401-
int32 status;
402-
bool return_value;
403-
404-
UT_Stub_GetInt32StatusCode(Context, &status);
401+
int32 status;
402+
bool return_value;
403+
CFE_SB_MsgId_t MsgId = UT_Hook_GetArgValueByName(Context, "MsgId", CFE_SB_MsgId_t);
405404

406-
return_value = status;
405+
if (UT_Stub_GetInt32StatusCode(Context, &status))
406+
{
407+
return_value = status;
408+
}
409+
else
410+
{
411+
/* The only invalid value UT's should be using is CFE_SB_INVALID_MSG_ID */
412+
return_value = !CFE_SB_MsgId_Equal(MsgId, CFE_SB_INVALID_MSG_ID);
413+
}
407414

408415
UT_Stub_SetReturnValue(FuncKey, return_value);
409416
}

0 commit comments

Comments
 (0)