From 55c60fa4a1c9f6476795670aab0ba595a640f377 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 1 Aug 2003 20:16:53 +0000 Subject: * class.c (rb_obj_singleton_methods): should not go up to ancestors unless the recursive flag is set. [ruby-list:38007] * hash.c (env_each_key): use env_keys to avoid environment modify on the fly. * hash.c (env_each_value): use env_values for safety. * hash.c (env_each): allocate environment array first. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index fd28c166f..44d4dd0d1 100644 --- a/eval.c +++ b/eval.c @@ -4099,16 +4099,20 @@ rb_yield_0(val, self, klass, flags, avalue) int len = 0; if (avalue) { len = RARRAY(val)->len; + if (len == 0) { + val = Qnil; + goto multi_values; + } if (len == 1) { val = RARRAY(val)->ptr[0]; } else { - goto mult_values; + goto multi_values; } } else if (val == Qundef) { val = Qnil; - mult_values: + multi_values: { NODE *curr = ruby_current_node; ruby_current_node = block->var; -- cgit