diff --git a/Mono.Cecil/TypeParser.cs b/Mono.Cecil/TypeParser.cs index 33ffb60f0..3345aa77e 100644 --- a/Mono.Cecil/TypeParser.cs +++ b/Mono.Cecil/TypeParser.cs @@ -390,8 +390,13 @@ static bool TryGetDefinition (ModuleDefinition module, Type type_info, out TypeR var nested_names = type_info.nested_names; if (!nested_names.IsNullOrEmpty ()) { - for (int i = 0; i < nested_names.Length; i++) - typedef = typedef.GetNestedType (nested_names [i]); + for (int i = 0; i < nested_names.Length; i++) { + var nested_type = typedef.GetNestedType (nested_names [i]); + if (nested_type == null) + return false; + + typedef = nested_type; + } } type = typedef;