summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/array.c b/array.c
index 8b2c4c5c8b..0e4061931f 100644
--- a/array.c
+++ b/array.c
@@ -2795,7 +2795,8 @@ take_items(VALUE obj, long n)
if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);
result = rb_ary_new2(n);
args[0] = result; args[1] = (VALUE)n;
- rb_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args);
+ if (rb_check_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args) == Qundef)
+ Check_Type(obj, T_ARRAY);
return result;
}