summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 22aa86da87..06d0ce9e68 100644
--- a/hash.c
+++ b/hash.c
@@ -393,8 +393,13 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
VALUE v = rb_check_array_type(RARRAY_PTR(tmp)[i]);
VALUE key, val = Qnil;
- if (NIL_P(v)) continue;
+ if (NIL_P(v)) {
+ rb_raise(rb_eArgError, "wrong element type (expected array)");
+ }
switch (RARRAY_LEN(v)) {
+ default:
+ rb_raise(rb_eArgError, "invalid number of elements (%ld for 1..2)",
+ RARRAY_LEN(v));
case 2:
val = RARRAY_PTR(v)[1];
case 1: