Fix redis erroring on non found blocks
authorest31 <MTest31@outlook.com>
Sat, 26 Sep 2015 21:29:08 +0000 (23:29 +0200)
committerest31 <MTest31@outlook.com>
Sat, 26 Sep 2015 21:42:55 +0000 (23:42 +0200)
Thanks to @netinetwalker for spotting the error, proposing a fix, and testing it.

Error due to @est31's merging changes to PR #3202 to add more error reporting for invalid reply types, commit:

524a7656e3e5cd671b05c13e2ad69cb84bad0423 "redis: throw error if block request failed"

Now we branch out on the valid reply type "not found".

src/database-redis.cpp

index d7f5379772822529bbfb91dece3a9372eecf98b6..9e47b516f0b0bfdfc35ba6ff171529ed5ed153bd 100644 (file)
@@ -126,6 +126,11 @@ std::string Database_Redis::loadBlock(const v3s16 &pos)
                throw FileNotGoodException(std::string(
                        "Redis command 'HGET %s %s' errored: ") + errstr);
        }
+       case REDIS_REPLY_NIL: {
+               // block not found in database
+               freeReplyObject(reply);
+               return "";
+       }
        }
        errorstream << "loadBlock: loading block " << PP(pos)
                << " returned invalid reply type " << reply->type