random.c: use rb_check_funcall

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-08-03 07:24:33 +00:00
parent 4b4d364e52
commit 1f71ea2fd2

View File

@ -1165,8 +1165,7 @@ range_values(VALUE vmax, VALUE *begp, VALUE *endp, int *exclp)
if (!rb_range_values(vmax, begp, &end, exclp)) return Qfalse;
if (endp) *endp = end;
if (NIL_P(end)) return Qnil;
if (!rb_respond_to(end, id_minus)) return Qfalse;
r = rb_funcallv(end, id_minus, 1, begp);
r = rb_check_funcall(end, id_minus, 1, begp);
if (NIL_P(r)) return Qfalse;
return r;
}