Author: jbevain
Date: 2005-12-22 09:30:30 -0500 (Thu, 22 Dec 2005)
New Revision: 54727

Modified:
   trunk/cecil/lib/ChangeLog
   trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs
Log:
2005-12-22  Jb Evain  <[EMAIL PROTECTED]>

        * Mono.Cecil/ModuleDefinition.cs:
                Protect import from null refs.


Modified: trunk/cecil/lib/ChangeLog
===================================================================
--- trunk/cecil/lib/ChangeLog   2005-12-22 09:42:36 UTC (rev 54726)
+++ trunk/cecil/lib/ChangeLog   2005-12-22 14:30:30 UTC (rev 54727)
@@ -1,3 +1,8 @@
+2005-12-22  Jb Evain  <[EMAIL PROTECTED]>
+
+       * Mono.Cecil/ModuleDefinition.cs:
+               Protect import from null refs.
+
 2005-12-21  Jb Evain  <[EMAIL PROTECTED]>
 
        * Mono.Cecil/StructureWriter.cs:

Modified: trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs      2005-12-22 09:42:36 UTC 
(rev 54726)
+++ trunk/cecil/lib/Mono.Cecil/ModuleDefinition.cs      2005-12-22 14:30:30 UTC 
(rev 54727)
@@ -223,11 +223,17 @@
 
                public TypeReference Import (Type type)
                {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+
                        return m_controller.Helper.ImportSystemType (type);
                }
 
                public MethodReference Import (SR.MethodBase meth)
                {
+                       if (meth == null)
+                               throw new ArgumentNullException ("meth");
+
                        if (meth is SR.ConstructorInfo)
                                return 
m_controller.Helper.ImportConstructorInfo (meth as SR.ConstructorInfo);
                        else
@@ -236,36 +242,57 @@
 
                public FieldReference Import (SR.FieldInfo field)
                {
+                       if (field == null)
+                               throw new ArgumentNullException ("field");
+
                        return m_controller.Helper.ImportFieldInfo (field);
                }
 
                public TypeReference Import (TypeReference type)
                {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+
                        return m_controller.Helper.ImportTypeReference (type);
                }
 
                public MethodReference Import (MethodReference meth)
                {
+                       if (meth == null)
+                               throw new ArgumentNullException ("meth");
+
                        return m_controller.Helper.ImportMethodReference (meth);
                }
 
                public FieldReference Import (FieldReference field)
                {
+                       if (field == null)
+                               throw new ArgumentNullException ("field");
+
                        return m_controller.Helper.ImportFieldReference (field);
                }
 
                public TypeDefinition Import (TypeDefinition type)
                {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+
                        return m_controller.Helper.ImportTypeDefinition (type);
                }
 
                public MethodDefinition Import (MethodDefinition meth)
                {
+                       if (meth == null)
+                               throw new ArgumentNullException ("meth");
+
                        return m_controller.Helper.ImportMethodDefinition 
(meth);
                }
 
                public FieldDefinition Import (FieldDefinition field)
                {
+                       if (field == null)
+                               throw new ArgumentNullException ("field");
+
                        return m_controller.Helper.ImportFieldDefinition 
(field);
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to