diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs index feec8ed..cb0be38 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs @@ -151,7 +151,8 @@ namespace Il2CppInspector // Metadata usages (addresses) // Unfortunately the value supplied in MetadataRegistration.matadataUsagesCount seems to be incorrect, // so we have to calculate the correct number of usages above before reading the usage address list from the binary - var addresses = Binary.Image.ReadMappedArray(Binary.MetadataRegistration.metadataUsages, usages.Count); + var count = usages.Keys.Max() + 1; + var addresses = Binary.Image.ReadMappedArray(Binary.MetadataRegistration.metadataUsages, (int) count); foreach (var usage in usages) usage.Value.SetAddress(addresses[usage.Key]);