DLL: Don't try to add property tokens if there is no definition

This commit is contained in:
Katy Coe
2021-01-10 03:32:30 +01:00
parent c56a4c6a3a
commit 96e15a7521

View File

@@ -253,7 +253,9 @@ namespace Il2CppInspector.Outputs
mProp.SetMethod = AddMethod(module, mType, prop.SetMethod); mProp.SetMethod = AddMethod(module, mType, prop.SetMethod);
// Add token attribute // Add token attribute
mProp.AddAttribute(module, tokenAttribute, ("Token", $"0x{prop.Definition.token:X8}")); // Generic properties and constructed properties (from disperate get/set methods) have no definition
if (prop.Definition != null)
mProp.AddAttribute(module, tokenAttribute, ("Token", $"0x{prop.Definition.token:X8}"));
// Add custom attribute attributes // Add custom attribute attributes
foreach (var ca in prop.CustomAttributes) foreach (var ca in prop.CustomAttributes)