diff options
author | Jb Evain <jbevain@gmail.com> | 2015-07-22 17:30:28 +0300 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2015-07-22 17:30:57 +0300 |
commit | 3723f62e1a68e27338490483dea387c02110049f (patch) | |
tree | 8f4d19cdaf5c6be7a9dcb99f0e81360b64d351ca | |
parent | 9ba8f0215f4826f827c3ef0ce261974ce9402500 (diff) |
Fix NRE when parsing non existing nested types
-rw-r--r-- | Mono.Cecil/TypeParser.cs | 9 |
1 files 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; |