]> git.saurik.com Git - redis.git/commitdiff
first skiplist fix, courtesy of valgrind
authorantirez <antirez@gmail.com>
Fri, 23 Oct 2009 20:16:50 +0000 (22:16 +0200)
committerantirez <antirez@gmail.com>
Fri, 23 Oct 2009 20:16:50 +0000 (22:16 +0200)
redis.c

diff --git a/redis.c b/redis.c
index aba37d8d576db38061ff7ec4a3f4679793cb1fec..7158de60f6a2625e7281cc54a3fc489fc50a0e16 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -3744,7 +3744,7 @@ static void zslInsert(zskiplist *zsl, double score, robj *obj) {
 
     x = zsl->header;
     for (i = zsl->level-1; i >= 0; i--) {
-        while (x->forward[i]->score < score)
+        while (x->forward[i] && x->forward[i]->score < score)
             x = x->forward[i];
         update[i] = x;
     }