summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/enum.c b/enum.c
index 875beb9eaf..c1efb1b5c2 100644
--- a/enum.c
+++ b/enum.c
@@ -149,9 +149,10 @@ enum_count(int argc, VALUE *argv, VALUE obj)
func = count_iter_i;
}
else {
- if (rb_respond_to(obj, id_size)) {
- return rb_funcall(obj, id_size, 0, 0);
- }
+ VALUE tmp;
+
+ tmp = rb_check_funcall(obj, id_size, 0, 0);
+ if (tmp != Qundef) return tmp;
func = count_all_i;
}
}