Skip to content

Commit

Permalink
Fixed nil pointer exception on disconnect event
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
  • Loading branch information
sebd71 committed Oct 5, 2017
1 parent 3929d71 commit 46defcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 46defcb

Please sign in to comment.