summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'range.c')
-rw-r--r--range.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/range.c b/range.c
index 74ac972..fc5ae36 100644
--- a/range.c
+++ b/range.c
@@ -190,6 +190,9 @@ range_length(rng)
first = rb_iv_get(rng, "first");
last = rb_iv_get(rng, "last");
+ if (RTEST(rb_funcall(first, '>', 1, last))) {
+ return INT2FIX(0);
+ }
if (!obj_is_kind_of(first, cNumeric)) {
return enum_length(rng);
}