Merge pull request #1320 from FurqanSoftware/v6

Prevent panic during nil to string type assertion
This commit is contained in:
Vladimir Mihailenco 2020-05-21 09:08:40 +03:00 committed by GitHub
commit 2aca83490d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -309,9 +309,10 @@ func (c *PubSub) newMessage(reply interface{}) (interface{}, error) {
case []interface{}:
switch kind := reply[0].(string); kind {
case "subscribe", "unsubscribe", "psubscribe", "punsubscribe":
channel, _ := reply[1].(string)
return &Subscription{
Kind: kind,
Channel: reply[1].(string),
Channel: channel,
Count: int(reply[2].(int64)),
}, nil
case "message":