mirror of
https://github.com/redis/go-redis.git
synced 2025-04-19 07:22:17 +03:00
Fix nil type assertion
This commit is contained in:
parent
cf6cf7f450
commit
eecd319ee3
@ -309,9 +309,11 @@ 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":
|
||||||
|
// Can be nil in case of "unsubscribe".
|
||||||
|
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…
x
Reference in New Issue
Block a user