Test for ranges where min > max

This commit is contained in:
Pieter Noordhuis
2011-01-17 11:10:30 +01:00
parent df278b8b0b
commit 8e1b327706
2 changed files with 8 additions and 0 deletions

View File

@ -196,6 +196,10 @@ static int zslValueInRange(double value, zrangespec *spec) {
int zslIsInRange(zskiplist *zsl, zrangespec *range) {
zskiplistNode *x;
/* Test for ranges that will always be empty. */
if (range->min > range->max ||
(range->min == range->max && (range->minex || range->maxex)))
return 0;
x = zsl->tail;
if (x == NULL || !zslValueInMinRange(x->score,range))
return 0;