lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
275 stars 126 forks source link

Fix nil panic in dispatcher #63

Closed michaelbeaumont closed 3 years ago

michaelbeaumont commented 3 years ago
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x8efd41]

goroutine 54 [running]:
github.com/lorenzodonini/ocpp-go/ocppj.(*DefaultServerDispatcher).messagePump(0xc0003845f0)
        /home/mike/projects/project/client/vendor/github.com/lorenzodonini/ocpp-go/ocppj/dispatcher.go:526 +0x201
created by github.com/lorenzodonini/ocpp-go/ocppj.(*DefaultServerDispatcher).Start
        /home/mike/projects/project/client/vendor/github.com/lorenzodonini/ocpp-go/ocppj/dispatcher.go:407 +0x6c

I believe here ServerQueueMap.Get returns nil because ServerQueueMap.Remove is called on disconnect.