[xbuild] Throw ArgumentNullException if target name is null
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / Project.cs
index 6e7971deb7a180d7e4efa22094243bc87f8cd9b2..3a8d2feda0b8d7afd7dffdf8c31c9ce07091f4c1 100644 (file)
@@ -351,9 +351,13 @@ namespace Microsoft.Build.BuildEngine {
                                initialTargetsBuilt = true;
                        }
 
-                       foreach (string target in targetNames)
+                       foreach (string target in targetNames) {
+                               if (target == null)
+                                       throw new ArgumentNullException ("Target name cannot be null");
+
                                if (!BuildTarget (target.Trim (), targetOutputs))
                                        return false;
+                       }
                                
                        return true;
                }