From 3b89543de69c623e76f3b00e263b1198bef0fb91 Mon Sep 17 00:00:00 2001 From: wenyekui Date: Fri, 1 Aug 2014 16:03:51 +0800 Subject: [PATCH] fix argument checking --- server/cmd_zset.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/server/cmd_zset.go b/server/cmd_zset.go index d2facd3..01bca01 100644 --- a/server/cmd_zset.go +++ b/server/cmd_zset.go @@ -121,16 +121,17 @@ func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err e min = math.MinInt64 } else { var lopen bool = false - if minBuf[0] == '(' { - lopen = true - minBuf = minBuf[1:] - } if len(minBuf) == 0 { err = ErrCmdParams return } + if minBuf[0] == '(' { + lopen = true + minBuf = minBuf[1:] + } + min, err = ledis.StrInt64(minBuf, nil) if err != nil { return @@ -150,15 +151,15 @@ func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err e max = math.MaxInt64 } else { var ropen = false - if maxBuf[0] == '(' { - ropen = true - maxBuf = maxBuf[1:] - } if len(maxBuf) == 0 { err = ErrCmdParams return } + if maxBuf[0] == '(' { + ropen = true + maxBuf = maxBuf[1:] + } max, err = ledis.StrInt64(maxBuf, nil) if err != nil {