IL2CPP: Fix crash when loading Il2CppCodeGenModule with no concrete methods (#58)
This commit is contained in:
@@ -235,7 +235,14 @@ namespace Il2CppInspector
|
||||
CodeGenModulePointers.Add(name, mp.Pointer);
|
||||
|
||||
// Read method pointers
|
||||
// If a module contains only interfaces, abstract methods and/or non-concrete generic methods,
|
||||
// the entire method pointer array will be NULL values, causing the methodPointer to be mapped to .bss
|
||||
// and therefore out of scope of the binary image
|
||||
try {
|
||||
ModuleMethodPointers.Add(module, Image.ReadMappedArray<ulong>(module.methodPointers, (int) module.methodPointerCount));
|
||||
} catch (InvalidOperationException) {
|
||||
ModuleMethodPointers.Add(module, new ulong[module.methodPointerCount]);
|
||||
}
|
||||
|
||||
// Read method invoker pointer indices - one per method
|
||||
MethodInvokerIndices.Add(module, Image.ReadMappedArray<int>(module.invokerIndices, (int) module.methodPointerCount));
|
||||
|
||||
@@ -146,6 +146,7 @@ namespace Il2CppInspector.Reflection
|
||||
.ToDictionary(g => g.Key, g => g.GroupBy(a => a.AttributeType).Select(g => g.First()).ToList());
|
||||
|
||||
// Create method invokers (one per signature, in invoker index order)
|
||||
// Generic type definitions have an invoker index of -1
|
||||
foreach (var method in MethodsByDefinitionIndex) {
|
||||
var index = package.GetInvokerIndex(method.DeclaringType.Assembly.ModuleDefinition, method.Definition);
|
||||
if (index != -1) {
|
||||
@@ -156,7 +157,6 @@ namespace Il2CppInspector.Reflection
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Some invokers are not initialized or missing, need to find out why
|
||||
// Create method invokers sourced from generic method invoker indices
|
||||
foreach (var spec in GenericMethods.Keys) {
|
||||
if (package.GenericMethodInvokerIndices.TryGetValue(spec, out var index)) {
|
||||
|
||||
Reference in New Issue
Block a user