diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-10 12:01:45 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-10 12:01:45 +0000 |
commit | fc9493aaea3ca029b2c6fffe887a41a121993146 (patch) | |
tree | 1bb0336a657a130d7f54101092cf7dc9388ac3bf /array.c | |
parent | f8f499620a140f3ee89f1a8dbc677b0af32e7530 (diff) | |
download | ruby-fc9493aaea3ca029b2c6fffe887a41a121993146.tar.gz ruby-fc9493aaea3ca029b2c6fffe887a41a121993146.tar.xz ruby-fc9493aaea3ca029b2c6fffe887a41a121993146.zip |
* array.c (rb_ary_slice_bang): should return nil if position out
of range. a patch from Akinori MUSHA <knu AT iDaemons.org>.
[ruby-dev:32518]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1888,6 +1888,7 @@ rb_ary_slice_bang(int argc, VALUE *argv, VALUE ary) delete_pos_len: if (pos < 0) { pos = RARRAY_LEN(ary) + pos; + if (pos < 0) return Qnil; } arg2 = rb_ary_subseq(ary, pos, len); rb_ary_splice(ary, pos, len, Qundef); /* Qnil/rb_ary_new2(0) */ |