From 1ab6f82c7e3195dfde5a58f2ae0b94a2cc1b8b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 8 Apr 2024 12:35:07 +0200 Subject: [PATCH] lib: smf: check for NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit don't execute share_paren() if the target is NULL in smf_execute_ancestor_exit_actions() Signed-off-by: Fin Maaß --- lib/smf/smf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/smf/smf.c b/lib/smf/smf.c index d869de47c6..ecc1074074 100644 --- a/lib/smf/smf.c +++ b/lib/smf/smf.c @@ -172,7 +172,8 @@ __unused static bool smf_execute_ancestor_exit_actions( for (const struct smf_state *tmp_state = ctx->current->parent; tmp_state != NULL; tmp_state = tmp_state->parent) { - if (!share_paren(target->parent, tmp_state) && tmp_state->exit) { + if ((target == NULL || !share_paren(target->parent, tmp_state)) && + tmp_state->exit) { tmp_state->exit(ctx); /* No need to continue if terminate was set */