lorenzodonini / ocpp-go

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

server crashed when parsing ocpp message #313

Open rocknoo7 opened 4 days ago

rocknoo7 commented 4 days ago

OCPP version: [x] 1.6 [ ] 2.0.1

I'm submitting a ...

[x] bug report [ ] feature request

Current behavior:

time="2024-11-27T03:26:16Z" level=error msg="handling failed for e4vnbfn: ocpp message (HhmAgICAb4A=): FormationViolation - parsing time \"\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"\" as \"2006\""
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xbfddf3]

goroutine 9853 [running]:
github.com/lorenzodonini/ocpp-go/ocppj.(*Endpoint).ParseMessage(0xc000425a00, {0xc000b4e1c0, 0x7?, 0x655e5747655e5747?}, {0x1605620?, 0xc000a81f00?})
    /workspace/source/vendor/github.com/lorenzodonini/ocpp-go/ocppj/ocppj.go:418 +0x773
github.com/lorenzodonini/ocpp-go/ocppj.(*Server).ocppMessageHandler(0xc000425a00, {0x1601330, 0xc00086b5c0}, {0xc000dfb600, 0x20, 0x1?})
    /workspace/source/vendor/github.com/lorenzodonini/ocpp-go/ocppj/server.go:221 +0x26c
github.com/lorenzodonini/ocpp-go/ws.(*Server).readPump(0xc0001f45a0, 0xc00086b5c0)
    /workspace/source/vendor/github.com/lorenzodonini/ocpp-go/ws/websocket.go:582 +0x14d
created by github.com/lorenzodonini/ocpp-go/ws.(*Server).wsHandler
    /workspace/source/vendor/github.com/lorenzodonini/ocpp-go/ws/websocket.go:543 +0xc4c

Expected behavior:

Steps to reproduce:

Related code:

insert short code snippets here

Other information:

insert the output here