added assertion in zslInsert() that ensures the inserted element score is not NaN

This commit is contained in:
antirez 2011-12-18 11:12:58 +01:00
parent 24accab2aa
commit a244a13b4c

View File

@ -76,6 +76,7 @@ zskiplistNode *zslInsert(zskiplist *zsl, double score, robj *obj) {
unsigned int rank[ZSKIPLIST_MAXLEVEL]; unsigned int rank[ZSKIPLIST_MAXLEVEL];
int i, level; int i, level;
redisAssert(!isnan(score));
x = zsl->header; x = zsl->header;
for (i = zsl->level-1; i >= 0; i--) { for (i = zsl->level-1; i >= 0; i--) {
/* store rank that is crossed to reach the insert position */ /* store rank that is crossed to reach the insert position */