From 46defcb47f5cb316d2be7903253f70115c14c4f4 Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Thu, 5 Oct 2017 16:19:29 +0200 Subject: [PATCH] Fixed nil pointer exception on disconnect event Signed-off-by: Sebastien Douheret --- client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 4914886..0a91db2 100644 --- a/client.go +++ b/client.go @@ -11,7 +11,7 @@ import ( type Options struct { Transport string //protocol name string,websocket polling... Query map[string]string //url的附加的参数 - Header map[string][]string + Header map[string][]string } type Client struct { @@ -164,7 +164,7 @@ func (client *Client) onPacket(decoder *decoder, packet *packet) ([]interface{}, } args := c.GetArgs() olen := len(args) - if olen > 0 { + if decoder != nil && olen > 0 { packet.Data = &args if err := decoder.DecodeData(packet); err != nil { return nil, err