From 148ed20b6920331493f5d5ca3c52eb6f1d321b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E9=A3=8E?= Date: Sun, 6 Jan 2013 12:53:23 +0800 Subject: [PATCH] bugfix: redis multi result --- service/redis-cli.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/service/redis-cli.lua b/service/redis-cli.lua index b29f0c41..52ae14c9 100644 --- a/service/redis-cli.lua +++ b/service/redis-cli.lua @@ -124,9 +124,13 @@ redcmd[42] = function(data) -- '*' local bulk = {} for i = 1,n do local line = readline "\r\n" - local bytes = tonumber(string.sub(line,2) + 2) - local data = readbytes(bytes) - table.insert(bulk, string.sub(data,1,-3)) + local bytes = tonumber(string.sub(line,2)) + if bytes < 0 then + table.insert(bulk, nil) + else + local data = readbytes(bytes + 2) + table.insert(bulk, string.sub(data,1,-3)) + end end response(true, bulk) end