Skip to content

Commit

Permalink
lib: smf: add NULL check in smf_execute_all_exit_actions
Browse files Browse the repository at this point in the history
Like in smf_execute_all_entry_actions(), add NULL check
in smf_execute_all_exit_actions().

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
  • Loading branch information
ccli8 committed Jun 3, 2024
1 parent fe03e0c commit 811a974
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/smf/smf.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ static bool smf_execute_all_exit_actions(struct smf_ctx *const ctx, const struct
{
struct internal_ctx *const internal = (void *)&ctx->internal;

for (const struct smf_state *to_execute = ctx->current; to_execute != topmost;
for (const struct smf_state *to_execute = ctx->current;
to_execute != NULL && to_execute != topmost;
to_execute = to_execute->parent) {
if (to_execute->exit) {
to_execute->exit(ctx);
Expand Down

0 comments on commit 811a974

Please sign in to comment.