File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
1
2
using System . Collections ;
2
3
using System . Management . Automation ;
3
4
@@ -22,7 +23,11 @@ public static string Format<TCmdlet>(
22
23
Range range ,
23
24
TCmdlet cmdlet ) where TCmdlet : PSCmdlet , IOutputWriter
24
25
{
25
- // todo add argument check
26
+ // todo implement notnull attribute for such a check
27
+ ValidateNotNull ( scriptDefinition , "scriptDefinition" ) ;
28
+ ValidateNotNull ( settings , "settings" ) ;
29
+ ValidateNotNull ( cmdlet , "cmdlet" ) ;
30
+
26
31
Helper . Instance = new Helper ( cmdlet . SessionState . InvokeCommand , cmdlet ) ;
27
32
Helper . Instance . Initialize ( ) ;
28
33
@@ -55,6 +60,14 @@ public static string Format<TCmdlet>(
55
60
return text . ToString ( ) ;
56
61
}
57
62
63
+ private static void ValidateNotNull < T > ( T obj , string name )
64
+ {
65
+ if ( obj == null )
66
+ {
67
+ throw new ArgumentNullException ( name ) ;
68
+ }
69
+ }
70
+
58
71
private static Settings GetCurrentSettings ( Settings settings , string rule )
59
72
{
60
73
return new Settings ( new Hashtable ( )
You can’t perform that action at this time.
0 commit comments