Skip to content

Commit

Permalink
Fix nil type assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed May 21, 2020
1 parent cf6cf7f commit eecd319
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,11 @@ func (c *PubSub) newMessage(reply interface{}) (interface{}, error) {
case []interface{}:
switch kind := reply[0].(string); kind {
case "subscribe", "unsubscribe", "psubscribe", "punsubscribe":
// Can be nil in case of "unsubscribe".
channel, _ := reply[1].(string)
return &Subscription{
Kind: kind,
Channel: reply[1].(string),
Channel: channel,
Count: int(reply[2].(int64)),
}, nil
case "message":
Expand Down

0 comments on commit eecd319

Please sign in to comment.