1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
shyouhei 2018-11-19 06:48:09 +00:00
parent 1a5b274ee2
commit 6bdca5d85e

View file

@ -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;