diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-19 06:48:09 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-19 06:48:09 +0000 |
commit | 6bdca5d85e15420082ac2e79f4bae1ff7bc5edbc (patch) | |
tree | 32ef19df26c679a4fb485ca2b5de4ffa62ce6bfd /array.c | |
parent | 1a5b274ee2ce0586bee3e0e656f4aea908ec574c (diff) |
array.c: avoid (VALUE)--
This args[1]-- overflows when it is zero. Should do that only
when we can say it is nonzero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -3598,7 +3598,8 @@ static VALUE take_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, cbarg)) { VALUE *args = (VALUE *)cbarg; - if (args[1]-- == 0) rb_iter_break(); + if (args[1] == 0) rb_iter_break(); + else args[1]--; if (argc > 1) val = rb_ary_new4(argc, argv); rb_ary_push(args[0], val); return Qnil; |