DLL: Output enum return type method bodies correctly

This commit is contained in:
Katy Coe
2021-01-10 07:38:50 +01:00
parent 96e15a7521
commit 15731e60db

View File

@@ -357,8 +357,8 @@ namespace Il2CppInspector.Outputs
if (mMethod.ReturnType.FullName == "System.Void") if (mMethod.ReturnType.FullName == "System.Void")
inst.Add(OpCodes.Ret.ToInstruction()); inst.Add(OpCodes.Ret.ToInstruction());
// Return default for value type // Return default for value type or enum
else if (mMethod.ReturnType.IsValueType) { else if (mMethod.ReturnType.IsValueType || ((MethodInfo) method).ReturnType.IsEnum) {
var result = new Local(mMethod.ReturnType); var result = new Local(mMethod.ReturnType);
mMethod.Body.Variables.Add(result); mMethod.Body.Variables.Add(result);