summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'range.c')
-rw-r--r--range.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/range.c b/range.c
index 697fc98..98509f4 100644
--- a/range.c
+++ b/range.c
@@ -57,15 +57,15 @@ range_eqq(rng, obj)
first = rb_iv_get(rng, "first");
last = rb_iv_get(rng, "last");
- if (FIXNUM_P(first) && FIXNUM_P(obj)) {
+ if (FIXNUM_P(first) && FIXNUM_P(obj) && FIXNUM_P(last)) {
if (FIX2INT(first) <= FIX2INT(obj) && FIX2INT(obj) <= FIX2INT(last)) {
return TRUE;
}
return FALSE;
}
else {
- if (rb_funcall(first, rb_intern("<="), 1, obj) &&
- rb_funcall(last, rb_intern(">="), 1, obj)) {
+ if (RTEST(rb_funcall(first, rb_intern("<="), 1, obj)) &&
+ RTEST(rb_funcall(last, rb_intern(">="), 1, obj))) {
return TRUE;
}
return FALSE;