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 ;
12using System . Collections ;
23using System . Management . Automation ;
34
@@ -22,7 +23,11 @@ public static string Format<TCmdlet>(
2223 Range range ,
2324 TCmdlet cmdlet ) where TCmdlet : PSCmdlet , IOutputWriter
2425 {
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+
2631 Helper . Instance = new Helper ( cmdlet . SessionState . InvokeCommand , cmdlet ) ;
2732 Helper . Instance . Initialize ( ) ;
2833
@@ -55,6 +60,14 @@ public static string Format<TCmdlet>(
5560 return text . ToString ( ) ;
5661 }
5762
63+ private static void ValidateNotNull < T > ( T obj , string name )
64+ {
65+ if ( obj == null )
66+ {
67+ throw new ArgumentNullException ( name ) ;
68+ }
69+ }
70+
5871 private static Settings GetCurrentSettings ( Settings settings , string rule )
5972 {
6073 return new Settings ( new Hashtable ( )
You can’t perform that action at this time.
0 commit comments