summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authordavidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-01 05:53:52 +0000
committerdavidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-01 05:53:52 +0000
commitd04b7871a12fa2ddbe518f53da9632d0bb37b906 (patch)
treec3109a1d0a2e13716b5a362ad7e235946834ddda /enum.c
parenta95d19bf5988b60d3649f18d267e25a666955476 (diff)
downloadruby-d04b7871a12fa2ddbe518f53da9632d0bb37b906.tar.gz
* enum.c (take_while_i, drop_while_i) add RTEST to handle nil return
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/enum.c b/enum.c
index 968250c326..5beb900d4f 100644
--- a/enum.c
+++ b/enum.c
@@ -1435,7 +1435,7 @@ enum_take(VALUE obj, VALUE n)
static VALUE
take_while_i(VALUE i, VALUE *ary)
{
- if (!rb_yield(i)) rb_iter_break();
+ if (!RTEST(rb_yield(i))) rb_iter_break();
rb_ary_push(*ary, i);
return Qnil;
}
@@ -1501,7 +1501,7 @@ enum_drop(VALUE obj, VALUE n)
static VALUE
drop_while_i(VALUE i, VALUE *args)
{
- if (!args[1] && !rb_yield(i)) {
+ if (!args[1] && !RTEST(rb_yield(i))) {
args[1] = Qtrue;
}
if (args[1]) {