2005-11-02 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
authorRafael Teixeira <monoman@gmail.com>
Wed, 2 Nov 2005 13:22:00 +0000 (13:22 -0000)
committerRafael Teixeira <monoman@gmail.com>
Wed, 2 Nov 2005 13:22:00 +0000 (13:22 -0000)
* typemanager.cs: avoiding some Null Pointer Exceptions in GetPertinentStandardModules

svn path=/trunk/mcs/; revision=52474

mcs/mbas/ChangeLog
mcs/mbas/typemanager.cs

index 562bd5b60de48b9451ab4ffa1df4e46378720475..89ffd8496f3420a7cb8f08615f033c8ed6d15dfd 100644 (file)
@@ -1,3 +1,6 @@
+2005-11-02  Rafael Teixeira <rafaelteixeirabr@hotmail.com> 
+       * typemanager.cs: avoiding some Null Pointer Exceptions in GetPertinentStandardModules
+
 2005-11-01 Aldo Monteiro do Nascimento <aldo@psl-pr.softwarelivre.org>
        * mb-parser.jay: created a new parser rule to match a interface
        declared inside another interface: "opt_interface_declaration"
index be732dc9db43b201f8260ff6dd86b9215ce91931..922e878c69a1461ade8c2384e1c4960cd3ac9a1b 100644 (file)
@@ -499,9 +499,9 @@ public class TypeManager {
                standardModules = n;
        }
 
-       /// 
-       ///  Registers a existing 'standard module' to lookup short-qualified or unqualified members
-       /// 
+       // 
+       //  Registers an existing 'standard module' to lookup short-qualified or unqualified members
+       // 
        private static void AddStandardModule(Type type)
        {
            object[] attributes = type.GetCustomAttributes(false);
@@ -519,23 +519,25 @@ public class TypeManager {
         }
        }
 
-       //
-       // 
-       //
+       /// <summary>
+       /// Find types from pertinent standard modules (from those namespaces in the scope)
+       /// <summary>
        public static Type[] GetPertinentStandardModules(params string[] namespaces)
        {
                ArrayList list = new ArrayList();
-               foreach(string Namespace in namespaces)
-               { 
-                       for(int i = 0; i < standardModules.Length; i++) {
-                               if (standardModules[i].Namespace.ToLower () == Namespace.ToLower ()) {
-                                       string name = standardModules[i].ToString();
-                                       Type t = LookupType(name);
-                                       if (t == null) {
-                                               System.Console.WriteLine("Could not find standard module '" + name + "'"); 
-                                       }
-                                       else {
-                                               list.Add(t);
+               if (standardModules != null && namespaces != null) {
+                       foreach(string Namespace in namespaces)
+                       { 
+                               for(int i = 0; i < standardModules.Length; i++) {
+                                       if (standardModules[i].Namespace.ToLower () == Namespace.ToLower ()) {
+                                               string name = standardModules[i].ToString();
+                                               Type t = LookupType(name);
+                                               if (t == null) {
+                                                       System.Console.WriteLine("Could not find standard module '" + name + "'"); 
+                                               }
+                                               else {
+                                                       list.Add(t);
+                                               }
                                        }
                                }
                        }