fix not being able to input parameter names with length 0 in HookMethod

This commit is contained in:
Evil Factory
2022-03-11 12:35:55 -03:00
parent 394dda97f3
commit 62c2769eb8

View File

@@ -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);
}