C# Fix deserialization of delegates that are 0-parameter overloads
Co-authored-by: Raul Santos <raulsntos@gmail.com>
This commit is contained in:
parent
46424488ed
commit
783facf60b
|
@ -500,24 +500,17 @@ namespace Godot
|
||||||
Type? returnType = hasReturn ? DeserializeType(reader) : typeof(void);
|
Type? returnType = hasReturn ? DeserializeType(reader) : typeof(void);
|
||||||
|
|
||||||
int parametersCount = reader.ReadInt32();
|
int parametersCount = reader.ReadInt32();
|
||||||
|
var parameterTypes = parametersCount == 0 ? Type.EmptyTypes : new Type[parametersCount];
|
||||||
|
|
||||||
if (parametersCount > 0)
|
for (int i = 0; i < parametersCount; i++)
|
||||||
{
|
{
|
||||||
var parameterTypes = new Type[parametersCount];
|
Type? parameterType = DeserializeType(reader);
|
||||||
|
if (parameterType == null)
|
||||||
for (int i = 0; i < parametersCount; i++)
|
return false;
|
||||||
{
|
parameterTypes[i] = parameterType;
|
||||||
Type? parameterType = DeserializeType(reader);
|
|
||||||
if (parameterType == null)
|
|
||||||
return false;
|
|
||||||
parameterTypes[i] = parameterType;
|
|
||||||
}
|
|
||||||
|
|
||||||
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags, null, parameterTypes, null);
|
|
||||||
return methodInfo != null && methodInfo.ReturnType == returnType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags);
|
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags, null, parameterTypes, null);
|
||||||
return methodInfo != null && methodInfo.ReturnType == returnType;
|
return methodInfo != null && methodInfo.ReturnType == returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue