fix argument checking

This commit is contained in:
wenyekui 2014-08-01 16:03:51 +08:00
parent 6947255c22
commit 3b89543de6
1 changed files with 9 additions and 8 deletions

View File

@ -121,16 +121,17 @@ func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err e
min = math.MinInt64 min = math.MinInt64
} else { } else {
var lopen bool = false var lopen bool = false
if minBuf[0] == '(' {
lopen = true
minBuf = minBuf[1:]
}
if len(minBuf) == 0 { if len(minBuf) == 0 {
err = ErrCmdParams err = ErrCmdParams
return return
} }
if minBuf[0] == '(' {
lopen = true
minBuf = minBuf[1:]
}
min, err = ledis.StrInt64(minBuf, nil) min, err = ledis.StrInt64(minBuf, nil)
if err != nil { if err != nil {
return return
@ -150,15 +151,15 @@ func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err e
max = math.MaxInt64 max = math.MaxInt64
} else { } else {
var ropen = false var ropen = false
if maxBuf[0] == '(' {
ropen = true
maxBuf = maxBuf[1:]
}
if len(maxBuf) == 0 { if len(maxBuf) == 0 {
err = ErrCmdParams err = ErrCmdParams
return return
} }
if maxBuf[0] == '(' {
ropen = true
maxBuf = maxBuf[1:]
}
max, err = ledis.StrInt64(maxBuf, nil) max, err = ledis.StrInt64(maxBuf, nil)
if err != nil { if err != nil {