fix not being able to input parameter names with length 0 in HookMethod
This commit is contained in:
@@ -1044,7 +1044,7 @@ namespace Barotrauma
|
|||||||
var classType = Type.GetType(className);
|
var classType = Type.GetType(className);
|
||||||
MethodInfo methodInfo = null;
|
MethodInfo methodInfo = null;
|
||||||
|
|
||||||
if (parameterNames.Length > 0)
|
if (parameterNames != null)
|
||||||
{
|
{
|
||||||
Type[] parameterTypes = parameterNames.Select(x => AccessTools.TypeByName(x)).ToArray();
|
Type[] parameterTypes = parameterNames.Select(x => AccessTools.TypeByName(x)).ToArray();
|
||||||
methodInfo = classType.GetMethod(methodName, DefaultBindingFlags, null, parameterTypes, null);
|
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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user