Skip to content

Commit

Permalink
fixed nil pointer dereference #72
Browse files Browse the repository at this point in the history
  • Loading branch information
wind-c committed Sep 12, 2023
1 parent 413358a commit 59a0774
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/config/single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ bridge-path: ./cmd/config/bridge-kafka.yml #The bridge config file path
pprof-enable: false #Whether to enable the performance analysis tool http://ip:6060

auth:
way: 1 #Authentication way: 0 anonymous, 1 username and password, 2 clientid
way: 0 #Authentication way: 0 anonymous, 1 username and password, 2 clientid
datasource: 1 #Optional items:0 free、1 redis、2 mysql、3 postgresql、4 http ...
conf-path: ./config/auth-redis.yml #The config file path should correspond to the auth-datasource
conf-path: ./cmd/config/auth-redis.yml #The config file path should correspond to the auth-datasource

mqtt:
tcp: :1883
Expand Down
5 changes: 4 additions & 1 deletion plugin/bridge/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ func (b *Bridge) OnDisconnect(cl *mqtt.Client, err error, expire bool) {
ClientID: cl.ID,
Username: string(cl.Properties.Username),
Timestamp: timestamp,
Payload: []byte(err.Error()),
}

if err != nil {
msg.Payload = []byte(err.Error())
}

data, err := msg.MarshalBinary()
Expand Down

0 comments on commit 59a0774

Please sign in to comment.