summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-23 17:40:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-23 17:40:14 +0000
commitd749616333e092b13948405164f4799b2884eddd (patch)
tree6fb0edd39264330fa688bcf8e0739d775c5dab23 /array.c
parent9d05b9a4b34862c7c9db80b5c3b3ed88bb526733 (diff)
* array.c (rb_ary_unshift_m): need to check number of arguments.
[ruby-talk:74189] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/array.c b/array.c
index 5aa268b..69bf714 100644
--- a/array.c
+++ b/array.c
@@ -427,7 +427,12 @@ rb_ary_unshift_m(argc, argv, ary)
VALUE ary;
{
long len = RARRAY(ary)->len;
-
+
+ if (argc < 0) {
+ rb_raise(rb_eArgError, "negative number of arguments");
+ }
+ if (argc == 0) return ary;
+
/* make rooms by setting the last item */
rb_ary_store(ary, len + argc - 1, Qnil);