diff --git a/fsw/src/sc_atsrq.c b/fsw/src/sc_atsrq.c index 0a15021..ad6a575 100644 --- a/fsw/src/sc_atsrq.c +++ b/fsw/src/sc_atsrq.c @@ -210,6 +210,12 @@ bool SC_BeginAts(SC_AtsIndex_t AtsIndex, uint16 TimeOffset) { /* first get the cmd index at this list entry */ CmdIndex = SC_CommandNumToIndex(SC_GetAtsCommandNumAtSeq(AtsIndex, TimeIndex)->CmdNum); + if (!SC_AtsCommandIndexIsValid(CmdIndex)) + { + SC_IDX_INCREMENT(TimeIndex); + continue; + } + /* then get the entry index from the cmd index table */ CmdOffsetRec = SC_GetAtsEntryOffsetForCmd(AtsIndex, CmdIndex); /* then get a pointer to the ATS entry data */ @@ -538,6 +544,12 @@ void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) { /* first get the cmd index at this list entry */ CmdIndex = SC_CommandNumToIndex(SC_GetAtsCommandNumAtSeq(AtsIndex, TimeIndex)->CmdNum); + if (!SC_AtsCommandIndexIsValid(CmdIndex)) + { + SC_IDX_INCREMENT(TimeIndex); + continue; + } + /* then get the entry index from the cmd index table */ CmdOffsetRec = SC_GetAtsEntryOffsetForCmd(AtsIndex, CmdIndex); /* then get a pointer to the ATS entry data */