summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-30 12:54:50 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-30 12:54:50 +0000
commit79e239cbd83ba7097c10fa939b813649f5a06cba (patch)
tree29507a1b95eeb04e95a62cb2606eb8da4de7f5fa /array.c
parentc42f46bfc7d177a0fc201ab731314d29e494422c (diff)
merge revision(s) 58693: [Backport #13558]
array.c: check position to insert * array.c (rb_ary_insert): check position to insert even if no elements to be inserted. [ruby-core:81125] [Bug #13558] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/array.c b/array.c
index 3bd267a51f..de81ee7fab 100644
--- a/array.c
+++ b/array.c
@@ -1766,8 +1766,8 @@ rb_ary_insert(int argc, VALUE *argv, VALUE ary)
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
rb_ary_modify_check(ary);
- if (argc == 1) return ary;
pos = NUM2LONG(argv[0]);
+ if (argc == 1) return ary;
if (pos == -1) {
pos = RARRAY_LEN(ary);
}