File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
ScriptEngine.HostedScript/Library Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,13 @@ public static ArrayImpl Constructor(IValue[] dimensions)
218218 ArrayImpl cloneable = null ;
219219 for ( int dim = dimensions . Length - 1 ; dim >= 0 ; dim -- )
220220 {
221+ if ( dimensions [ dim ] == null )
222+ throw RuntimeException . InvalidNthArgumentType ( dim + 1 ) ;
223+
221224 int bound = ( int ) dimensions [ dim ] . AsNumber ( ) ;
225+ if ( bound <= 0 )
226+ throw RuntimeException . InvalidNthArgumentValue ( dim + 1 ) ;
227+
222228 var newInst = new ArrayImpl ( ) ;
223229 FillArray ( newInst , bound ) ;
224230 if ( cloneable != null )
Original file line number Diff line number Diff line change @@ -110,7 +110,12 @@ public static RuntimeException InvalidArgumentType(string argName)
110110 return new RuntimeException ( String . Format ( "Неверный тип аргумента '{0}'" , argName ) ) ;
111111 }
112112
113- public static RuntimeException InvalidArgumentType ( int argNum , string argName = "" )
113+ public static RuntimeException InvalidNthArgumentType ( int argNum )
114+ {
115+ return new RuntimeException ( String . Format ( "Неверный тип аргумента номер {0}" , argNum ) ) ;
116+ }
117+
118+ public static RuntimeException InvalidArgumentType ( int argNum , string argName )
114119 {
115120 return new RuntimeException ( String . Format ( "Неверный тип аргумента номер {0} '{1}'" , argNum , argName ) ) ;
116121 }
@@ -120,6 +125,11 @@ public static RuntimeException InvalidArgumentValue()
120125 return new RuntimeException ( "Неверное значение аргумента" ) ;
121126 }
122127
128+ public static RuntimeException InvalidNthArgumentValue ( int argNum )
129+ {
130+ return new RuntimeException ( String . Format ( "Неверное значение аргумента номер {0}" , argNum ) ) ;
131+ }
132+
123133 public static RuntimeException InvalidArgumentValue ( object value )
124134 {
125135 return new RuntimeException ( "Неверное значение аргумента {" + value . ToString ( ) + "}" ) ;
You can’t perform that action at this time.
0 commit comments