From 62c2769eb8eee33d0580173307ca97d27d78df4d Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Fri, 11 Mar 2022 12:35:55 -0300 Subject: [PATCH] fix not being able to input parameter names with length 0 in HookMethod --- Barotrauma/BarotraumaShared/SharedSource/Lua/LuaClasses.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaClasses.cs b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaClasses.cs index a460f7db0..345910ec0 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaClasses.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaClasses.cs @@ -1044,7 +1044,7 @@ namespace Barotrauma var classType = Type.GetType(className); MethodInfo methodInfo = null; - if (parameterNames.Length > 0) + if (parameterNames != null) { Type[] parameterTypes = parameterNames.Select(x => AccessTools.TypeByName(x)).ToArray(); methodInfo = classType.GetMethod(methodName, DefaultBindingFlags, null, parameterTypes, null); @@ -1122,7 +1122,7 @@ namespace Barotrauma public void HookMethod(string className, string methodName, object hookMethod, HookMethodType hookMethodType = HookMethodType.Before) { - HookMethod(className, methodName, new string[] {}, hookMethod, hookMethodType); + HookMethod(className, methodName, null, hookMethod, hookMethodType); }