Don't panic if multi bulk parser is nil

This commit is contained in:
Vladimir Mihailenco 2019-06-16 14:06:13 +03:00
parent aa5f492665
commit 246d502457
1 changed files with 4 additions and 0 deletions

View File

@ -82,6 +82,10 @@ func (r *Reader) ReadReply(m MultiBulkParse) (interface{}, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
if m == nil {
err := fmt.Errorf("redis: got %.100q, but multi bulk parser is nil", line)
return nil, err
}
return m(r, n) return m(r, n)
} }
return nil, fmt.Errorf("redis: can't parse %.100q", line) return nil, fmt.Errorf("redis: can't parse %.100q", line)