Skip to content

Commit 59a0774

Browse files
committed
fixed nil pointer dereference #72
1 parent 413358a commit 59a0774

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmd/config/single.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ bridge-path: ./cmd/config/bridge-kafka.yml #The bridge config file path
55
pprof-enable: false #Whether to enable the performance analysis tool http://ip:6060
66

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

1212
mqtt:
1313
tcp: :1883

plugin/bridge/kafka/kafka.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ func (b *Bridge) OnDisconnect(cl *mqtt.Client, err error, expire bool) {
276276
ClientID: cl.ID,
277277
Username: string(cl.Properties.Username),
278278
Timestamp: timestamp,
279-
Payload: []byte(err.Error()),
279+
}
280+
281+
if err != nil {
282+
msg.Payload = []byte(err.Error())
280283
}
281284

282285
data, err := msg.MarshalBinary()

0 commit comments

Comments
 (0)