File tree 3 files changed +1250
-9
lines changed
3 files changed +1250
-9
lines changed Original file line number Diff line number Diff line change @@ -83,16 +83,20 @@ function ArrayIndex( x ) {
83
83
84
84
// When provided a "generic" array or an array of an unknown data type, attempt to infer the type of index array...
85
85
if ( dt === 'generic' || dt === null ) {
86
- get = resolveGetter ( x ) ;
87
- v = get ( x , 0 ) ;
88
-
89
- // Infer the "type" of index array from the first element...
90
- if ( isBoolean ( v ) ) {
91
- t = 'bool' ;
92
- } else if ( isInteger ( v ) ) {
93
- t = 'int' ;
86
+ if ( x . length > 0 ) {
87
+ get = resolveGetter ( x ) ;
88
+ v = get ( x , 0 ) ;
89
+
90
+ // Infer the "type" of index array from the first element...
91
+ if ( isBoolean ( v ) ) {
92
+ t = 'bool' ;
93
+ } else if ( isInteger ( v ) ) {
94
+ t = 'int' ;
95
+ } else {
96
+ throw new TypeError ( 'invalid argument. First argument must be a valid index array.' ) ;
97
+ }
94
98
} else {
95
- throw new TypeError ( 'invalid argument. First argument must be a valid index array.' ) ;
99
+ t = 'int' ;
96
100
}
97
101
} else if ( dt === 'int32' ) {
98
102
t = 'int' ;
You can’t perform that action at this time.
0 commit comments