From f2e4106a0c3db33b593f358edbdf0a88a5795d0f Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Mon, 6 Dec 2021 14:58:58 -0300 Subject: [PATCH] fix error handling with Action callbacks causing server crashes --- .../BarotraumaShared/SharedSource/Lua/LuaCustomConverters.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaCustomConverters.cs b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaCustomConverters.cs index c9f6f5f7b..0b4969ed6 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaCustomConverters.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaCustomConverters.cs @@ -58,7 +58,7 @@ namespace Barotrauma Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Function, typeof(Action), v => { var function = v.Function; - return (Action)(p => function.Call(p)); + return (Action)(p => LuaSetup.luaSetup.CallFunction(function, p)); }); } @@ -67,7 +67,7 @@ namespace Barotrauma Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Function, typeof(Action), v => { var function = v.Function; - return (Action)(() => function.Call()); + return (Action)(() => LuaSetup.luaSetup.CallFunction(function)); }); }