From efebb1841f7257801a14751bdbd9025f3a659e29 Mon Sep 17 00:00:00 2001 From: romain pelletant Date: Tue, 24 Oct 2023 14:05:57 +0200 Subject: [PATCH] modem_chat: fix hard fault on script stop Fix fault on modem_cellular disconnection/reconnection Issue #64291 Signed-off-by: romain pelletant --- subsys/modem/modem_chat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index fb934f7732c..0ab1175f980 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -60,6 +60,10 @@ static void modem_chat_log_received_command(struct modem_chat *chat) static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_script_result result) { + if (!chat || !chat->script) { + return; + } + /* Handle result */ if (result == MODEM_CHAT_SCRIPT_RESULT_SUCCESS) { LOG_DBG("%s: complete", chat->script->name);