summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-15 06:27:30 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-15 06:27:30 (GMT)
commit723cee93c481e62579e5353d9128e1538381cbab (patch)
treedcd59219045d5b5ad7dc913b520239d47b6f2ca6 /enum.c
parente02c5f346fd54d9183aaba3eab517bcf7a0613f1 (diff)
enum.c: nil if no iteration
* enum.c (enum_inject): return nil if no iteration, instead of Qundef. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/enum.c b/enum.c
index b139b69..f05c556 100644
--- a/enum.c
+++ b/enum.c
@@ -663,6 +663,7 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
}
memo = NEW_MEMO(init, Qnil, op);
rb_block_call(obj, id_each, 0, 0, iter, (VALUE)memo);
+ if (memo->u1.value == Qundef) return Qnil;
return memo->u1.value;
}