Skip to content

Commit

Permalink
Avoid a potential NRE if the nested type mapping is wrong (obfuscator)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbevain committed Jul 2, 2012
1 parent a8f871a commit aea2ceb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Mono.Cecil/AssemblyReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit aea2ceb

Please sign in to comment.