Skip to content

Commit eecd319

Browse files
committed
Fix nil type assertion
1 parent cf6cf7f commit eecd319

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pubsub.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,11 @@ func (c *PubSub) newMessage(reply interface{}) (interface{}, error) {
309309
case []interface{}:
310310
switch kind := reply[0].(string); kind {
311311
case "subscribe", "unsubscribe", "psubscribe", "punsubscribe":
312+
// Can be nil in case of "unsubscribe".
313+
channel, _ := reply[1].(string)
312314
return &Subscription{
313315
Kind: kind,
314-
Channel: reply[1].(string),
316+
Channel: channel,
315317
Count: int(reply[2].(int64)),
316318
}, nil
317319
case "message":

0 commit comments

Comments
 (0)