aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-12 17:02:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-12 17:02:48 +0000
commitc2a855cc1ce91f1b969573e77539aa353c77a6db (patch)
tree8952975f0aebd67f57dd6378e9e01e3334985374 /array.c
parent82775102a4e9e049c65c127219434435b06acdcd (diff)
downloadruby-c2a855cc1ce91f1b969573e77539aa353c77a6db.tar.gz
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/trunk@58693 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 e21c01194c..1eb1d2ea35 100644
--- a/array.c
+++ b/array.c
@@ -1781,8 +1781,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);
}