Merge pull request #1058 from go-redis/fix/panic-multi-bulk-parser

Don't panic if multi bulk parser is nil
This commit is contained in:
Vladimir Mihailenco 2019-06-16 14:37:30 +03:00 committed by GitHub
commit 5b3e40b336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)