When dynamically compiling script with a class with a nested class defined, the colle...
authorgodFather89 <tatarandrei@gmail.com>
Mon, 12 May 2014 09:29:51 +0000 (05:29 -0400)
committergodFather89 <tatarandrei@gmail.com>
Mon, 12 May 2014 09:29:51 +0000 (05:29 -0400)
Example:
class test
{
 class asd
 {
 }
}

mcs/mcs/eval.cs

index 766bb05696b6f9e815d0b80ee621c3e1c54194f7..5bda997062587af84c2d227d0cf5e371c5dea3ef 100644 (file)
@@ -1233,10 +1233,13 @@ namespace Mono.CSharp
                        if (undo_actions == null)
                                undo_actions = new List<Action> ();
 
-                       var existing = current_container.Containers.FirstOrDefault (l => l.Basename == tc.Basename);
-                       if (existing != null) {
-                               current_container.RemoveContainer (existing);
-                               undo_actions.Add (() => current_container.AddTypeContainer (existing));
+                       if (current_container.Containers != null)
+                       {
+                               var existing = current_container.Containers.FirstOrDefault (l => l.Basename == tc.Basename);
+                               if (existing != null) {
+                                       current_container.RemoveContainer (existing);
+                                       undo_actions.Add (() => current_container.AddTypeContainer (existing));
+                               }
                        }
 
                        undo_actions.Add (() => current_container.RemoveContainer (tc));