From 212c01745cdfa7a47d795c66208cc1ea78907fd6 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sun, 9 Aug 2020 18:07:46 +0200 Subject: [PATCH] Model: Don't crash on GetCustomAttributes(TypeInfo) if Definition is null (arrays, generics etc.) --- Il2CppInspector.Common/Reflection/CustomAttributeData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Il2CppInspector.Common/Reflection/CustomAttributeData.cs b/Il2CppInspector.Common/Reflection/CustomAttributeData.cs index 46bc0e2..784c38e 100644 --- a/Il2CppInspector.Common/Reflection/CustomAttributeData.cs +++ b/Il2CppInspector.Common/Reflection/CustomAttributeData.cs @@ -77,6 +77,6 @@ namespace Il2CppInspector.Reflection public static IList GetCustomAttributes(ParameterInfo param) => getCustomAttributes(param.DeclaringMethod.Assembly, param.Definition.token, param.Definition.customAttributeIndex); public static IList GetCustomAttributes(PropertyInfo prop) => prop.Definition != null ? getCustomAttributes(prop.Assembly, prop.Definition.token, prop.Definition.customAttributeIndex) : new List(); - public static IList GetCustomAttributes(TypeInfo type) => getCustomAttributes(type.Assembly, type.Definition.token, type.Definition.customAttributeIndex); + public static IList GetCustomAttributes(TypeInfo type) => type.Definition != null? getCustomAttributes(type.Assembly, type.Definition.token, type.Definition.customAttributeIndex) : new List(); } }