summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-05 22:14:25 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-05 22:14:25 +0000
commitdcb8a22f2670626198ecf1c805b53bd13350d899 (patch)
tree81e00f65c2fb3f233816186246e5deaeef6d2ee9 /enum.c
parent3280f54168069d207834d9d15b0fb2ffa17168ce (diff)
Fix size on Enumerable#cycle when the size is 0 [Bug #14082].
Patch by Kenichi Kamiya git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60666 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 4613ab733c..2b2806a6c8 100644
--- a/enum.c
+++ b/enum.c
@@ -2845,6 +2845,7 @@ enum_cycle_size(VALUE self, VALUE args, VALUE eobj)
VALUE size = enum_size(self, args, 0);
if (size == Qnil) return Qnil;
+ if (FIXNUM_ZERO_P(size)) return size;
if (args && (RARRAY_LEN(args) > 0)) {
n = RARRAY_AREF(args, 0);