HDEL: Abort deleting fields when hash is removed

This commit is contained in:
Pieter Noordhuis
2011-07-27 12:29:36 +02:00
parent 80e87a461a
commit 2d7162bb1d
2 changed files with 11 additions and 1 deletions

View File

@ -403,8 +403,11 @@ void hdelCommand(redisClient *c) {
for (j = 2; j < c->argc; j++) {
if (hashTypeDelete(o,c->argv[j])) {
if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]);
deleted++;
if (hashTypeLength(o) == 0) {
dbDelete(c->db,c->argv[1]);
break;
}
}
}
if (deleted) {