Permalink
Browse files

Avoid a potential NRE if the nested type mapping is wrong (obfuscator)

  • Loading branch information...
1 parent a8f871a commit aea2ceb687f989670d31db5232c77d089b0124ca @jbevain jbevain committed Jul 2, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 Mono.Cecil/AssemblyReader.cs
@@ -778,8 +778,12 @@ public Collection<TypeDefinition> ReadNestedTypes (TypeDefinition type)
var nested_types = new MemberDefinitionCollection<TypeDefinition> (type, mapping.Length);
- for (int i = 0; i < mapping.Length; i++)
- nested_types.Add (GetTypeDefinition (mapping [i]));
+ for (int i = 0; i < mapping.Length; i++) {
+ var nested_type = GetTypeDefinition (mapping [i]);
+
+ if (nested_type != null)
+ nested_types.Add (nested_type);
+ }
metadata.RemoveNestedTypeMapping (type);

0 comments on commit aea2ceb

Please sign in to comment.