AppModel: Don't crash on MetadataUsage MethodDef/Ref without prior method definition

This commit is contained in:
Katy Coe
2020-08-07 19:08:27 +02:00
parent 7086a8f7ba
commit 32497364e5

View File

@@ -210,7 +210,13 @@ namespace Il2CppInspector.Model
var method = ILModel.GetMetadataUsageMethod(usage); var method = ILModel.GetMetadataUsageMethod(usage);
declarationGenerator.IncludeMethod(method); declarationGenerator.IncludeMethod(method);
AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations()); AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations());
// Any method here SHOULD already be in the Methods list
// but we have seen one example where this is not the case for a MethodDef
if (!Methods.ContainsKey(method)) {
var fnPtr = declarationGenerator.GenerateMethodDeclaration(method);
Methods.Add(method, fnPtr, new AppMethod(method, fnPtr) {Group = Group});
}
Methods[method].MethodInfoPtrAddress = address; Methods[method].MethodInfoPtrAddress = address;
break; break;
} }