File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -122,10 +122,12 @@ namespace RC
122122
123123 static auto lua_unreal_script_function_hook_pre (Unreal::UnrealScriptFunctionCallableContext context, void * custom_data) -> void
124124 {
125-
126125 // Fetch the data corresponding to this UFunction
127126 auto & lua_data = *static_cast <LuaUnrealScriptFunctionData*>(custom_data);
128127
128+ // Check if this hook has been scheduled for removal (Lua state may be invalid)
129+ if (lua_data.scheduled_for_removal ) return ;
130+
129131 // This is a promise that we're in the game thread, used by other functions to ensure that we don't execute when unsafe
130132 set_is_in_game_thread (lua_data.lua , true );
131133
@@ -239,6 +241,9 @@ namespace RC
239241 // Fetch the data corresponding to this UFunction
240242 auto & lua_data = *static_cast <LuaUnrealScriptFunctionData*>(custom_data);
241243
244+ // Check if this hook has been scheduled for removal (Lua state may be invalid)
245+ if (lua_data.scheduled_for_removal ) return ;
246+
242247 // This is a promise that we're in the game thread, used by other functions to ensure that we don't execute when unsafe
243248 set_is_in_game_thread (lua_data.lua , true );
244249
You can’t perform that action at this time.
0 commit comments