From b82ee2453e39037a577bf20bfd16667ed9bfa8eb Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Mon, 26 Jan 2026 18:56:59 -0500 Subject: [PATCH] Fix custom bhv crash --- src/engine/behavior_script.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c index 8bfbdc3aa..52aedaba1 100644 --- a/src/engine/behavior_script.c +++ b/src/engine/behavior_script.c @@ -987,6 +987,11 @@ static s32 bhv_cmd_call_native_ext(void) { } const char *funcStr = dynos_behavior_get_token(behavior, BHV_CMD_GET_U32(1)); + if (!funcStr) { + LOG_LUA("Could not retrieve function name from behavior command. Do you have an unclosed behavior script?"); + gCurBhvCommand += 2; + return BHV_PROC_CONTINUE; + } gSmLuaConvertSuccess = true; LuaFunction funcRef = smlua_get_function_mod_variable(modIndex, funcStr);