summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index aa0010d92..ad976f4c2 100644
--- a/eval.c
+++ b/eval.c
@@ -8555,10 +8555,13 @@ VALUE
rb_proc_yield(int argc, VALUE *argv, VALUE proc)
{
switch (argc) {
+ case 1:
+ if (!NIL_P(argv[0])) {
+ return proc_invoke(proc, argv[0], Qundef, 0, 0);
+ }
+ /* fall through */
case 0:
return proc_invoke(proc, Qundef, Qundef, 0, 0);
- case 1:
- return proc_invoke(proc, argv[0], Qundef, 0, 0);
default:
return proc_invoke(proc, rb_ary_new4(argc, argv), Qundef, 0, 0);
}