fix bug when result is a empty string from redis-server

This commit is contained in:
ubuntu14 2015-04-20 22:22:53 -07:00
parent 6795c9dfd7
commit 91dd70f286
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,10 @@
修改历史列表:
------------------------------------------------------------------------
302) 2015.4.21
302.1) buffix: redis_client::get_redis_string 当数据长度为 0 时会出现异常,
从而兼容 redis 是允许数据值为空串的情况
301) 2015.4.19
301.1) feature: 完善了 redis_cluster 集群管理类

View File

@ -146,7 +146,7 @@ redis_result* redis_client::get_redis_string(dbuf_pool* pool)
{
rr->set_size(1);
buf = (char*) pool->dbuf_alloc(len + 1);
if (conn_.read(buf, (size_t) len) == -1)
if (len > 0 && conn_.read(buf, (size_t) len) == -1)
return NULL;
buf[len] = 0;
rr->put(buf, (size_t) len);