From 3723f62e1a68e27338490483dea387c02110049f Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Wed, 22 Jul 2015 16:30:28 +0200 Subject: Fix NRE when parsing non existing nested types --- Mono.Cecil/TypeParser.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Mono.Cecil/TypeParser.cs b/Mono.Cecil/TypeParser.cs index 33ffb60..3345aa7 100644 --- a/Mono.Cecil/TypeParser.cs +++ b/Mono.Cecil/TypeParser.cs @@ -390,8 +390,13 @@ namespace Mono.Cecil { 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; -- cgit v1.2.3