mirror of https://github.com/go-redis/redis.git
Prevent panic during nil to string type assertion; closes #1319
This commit is contained in:
parent
99cd690a70
commit
a204d6794a
|
@ -309,9 +309,10 @@ func (c *PubSub) newMessage(reply interface{}) (interface{}, error) {
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
switch kind := reply[0].(string); kind {
|
switch kind := reply[0].(string); kind {
|
||||||
case "subscribe", "unsubscribe", "psubscribe", "punsubscribe":
|
case "subscribe", "unsubscribe", "psubscribe", "punsubscribe":
|
||||||
|
channel, _ := reply[1].(string)
|
||||||
return &Subscription{
|
return &Subscription{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Channel: reply[1].(string),
|
Channel: channel,
|
||||||
Count: int(reply[2].(int64)),
|
Count: int(reply[2].(int64)),
|
||||||
}, nil
|
}, nil
|
||||||
case "message":
|
case "message":
|
||||||
|
|
Loading…
Reference in New Issue