diff options
author | jbevain <jbevain@gmail.com> | 2011-07-23 21:50:48 +0400 |
---|---|---|
committer | jbevain <jbevain@gmail.com> | 2011-07-23 21:52:10 +0400 |
commit | 92c7f45243a945886863dc8bfd24d6e52cde1e54 (patch) | |
tree | d5f7cae17e7a63152dff1e2ebc12a088116a6180 /Mono.Cecil | |
parent | 23ac06c1c5108ad3eac651196672c7e01b2f005d (diff) |
Protect now public API against null
Diffstat (limited to 'Mono.Cecil')
-rw-r--r-- | Mono.Cecil/MetadataResolver.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Mono.Cecil/MetadataResolver.cs b/Mono.Cecil/MetadataResolver.cs index 7b1cc84..e69fcd7 100644 --- a/Mono.Cecil/MetadataResolver.cs +++ b/Mono.Cecil/MetadataResolver.cs @@ -27,7 +27,6 @@ // using System; -using System.Collections.Generic; using Mono.Collections.Generic; @@ -84,11 +83,17 @@ namespace Mono.Cecil { public MetadataResolver (IAssemblyResolver assemblyResolver) { + if (assemblyResolver == null) + throw new ArgumentNullException ("assemblyResolver"); + assembly_resolver = assemblyResolver; } public virtual TypeDefinition Resolve (TypeReference type) { + if (type == null) + throw new ArgumentNullException ("type"); + type = type.GetElementType (); var scope = type.Scope; @@ -154,6 +159,9 @@ namespace Mono.Cecil { public virtual FieldDefinition Resolve (FieldReference field) { + if (field == null) + throw new ArgumentNullException ("field"); + var type = Resolve (field.DeclaringType); if (type == null) return null; @@ -199,6 +207,9 @@ namespace Mono.Cecil { public virtual MethodDefinition Resolve (MethodReference method) { + if (method == null) + throw new ArgumentNullException ("method"); + var type = Resolve (method.DeclaringType); if (type == null) return null; |