]> git.saurik.com Git - redis.git/commitdiff
RDB hashes loading fixed removing the assertion that failed every time an HT-encoded...
authorantirez <antirez@gmail.com>
Tue, 13 Mar 2012 08:49:11 +0000 (09:49 +0100)
committerantirez <antirez@gmail.com>
Tue, 13 Mar 2012 08:49:21 +0000 (09:49 +0100)
src/rdb.c

index 518fef02c10cbba5561b1356ca4c02bde407037a..4a56659de07554320e5077c72f7c2b7364019b5c 100644 (file)
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -844,9 +844,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
             hashTypeConvert(o, REDIS_ENCODING_HT);
 
         /* Load every field and value into the ziplist */
-        while (o->encoding == REDIS_ENCODING_ZIPLIST && len-- > 0) {
+        while (o->encoding == REDIS_ENCODING_ZIPLIST && len > 0) {
             robj *field, *value;
 
+            len--;
             /* Load raw strings */
             field = rdbLoadStringObject(rdb);
             if (field == NULL) return NULL;
@@ -869,9 +870,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
         }
 
         /* Load remaining fields and values into the hash table */
-        while (o->encoding == REDIS_ENCODING_HT && len-- > 0) {
+        while (o->encoding == REDIS_ENCODING_HT && len > 0) {
             robj *field, *value;
 
+            len--;
             /* Load encoded strings */
             field = rdbLoadEncodedStringObject(rdb);
             if (field == NULL) return NULL;