Skip to content

Commit 70d34d7

Browse files
author
Aaron Goodman
committed
fix up rarray subscript operation
1 parent ae4e6eb commit 70d34d7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/rsruby/rarray.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def subset(_keys,_dim)
3030
new_order = _keys.map{|x|
3131
all_keys.index(x)
3232
}
33-
new_order=new_order.compact
3433
new_array = subset_helper(@array,new_order,0,_dim)
3534
if @dimnames.is_a? Array
3635
new_dimnames = @dimnames.dup
@@ -44,7 +43,7 @@ def subset(_keys,_dim)
4443
def subset_helper(_array,_new_order,_current_depth,_target_depth)
4544
if _current_depth == _target_depth
4645
_new_order.map{|x|
47-
_array.fetch(x)
46+
x.nil? ? nil : _array.fetch(x)
4847
}
4948
else
5049
_array.map{|x|

0 commit comments

Comments
 (0)