From 007779df621c4848ad92a72f7328a2c4c2d3abd0 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Thu, 30 Jan 2020 07:56:33 +0100 Subject: [PATCH] Model: Don't return duplicates or nulls in Model.Types Prevents duplicates appearing in IDA Python script --- Il2CppInspector/Reflection/Il2CppModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector/Reflection/Il2CppModel.cs b/Il2CppInspector/Reflection/Il2CppModel.cs index 579a4ff..cc492a6 100644 --- a/Il2CppInspector/Reflection/Il2CppModel.cs +++ b/Il2CppInspector/Reflection/Il2CppModel.cs @@ -30,7 +30,8 @@ namespace Il2CppInspector.Reflection public ConcurrentDictionary TypesByVirtualAddress { get; } = new ConcurrentDictionary(); // Every type - public IEnumerable Types => new IEnumerable[] {TypesByDefinitionIndex, TypesByReferenceIndex, TypesByVirtualAddress.Values}.SelectMany(t => t); + public IEnumerable Types => new IEnumerable[] {TypesByDefinitionIndex, TypesByReferenceIndex, TypesByVirtualAddress.Values} + .SelectMany(t => t).Where(t => t != null).Distinct(); // List of all methods ordered by their MethodDefinitionIndex public MethodBase[] MethodsByDefinitionIndex { get; }