stampzilla / stampzilla-go

Homeautomation software written in Go and React
Apache License 2.0
34 stars 3 forks source link

sending enocean command to unknown unit causes panic #26

Closed jonaz closed 9 years ago

jonaz commented 9 years ago
runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x40c247]

goroutine 10 [running]:
main.(*Device).handler(0x0, 0x0, 0x0)
        /home/stampzilla/go/src/github.com/stampzilla/stampzilla-go/nodes/stampzilla-enocean/state.go:136 +0x107
main.(*Device).CmdOn(0x0)
        /home/stampzilla/go/src/github.com/stampzilla/stampzilla-go/nodes/stampzilla-enocean/state.go:139 +0x28
main.processCommand(0x0, 0xc2080d2860, 0x2, 0xc20803ed40, 0x1, 0x4, 0x0, 0x0, 0x0)
        /home/stampzilla/go/src/github.com/stampzilla/stampzilla-go/nodes/stampzilla-enocean/main.go:127 +0x47a
main.serverRecv(0xc20801fd80)
        /home/stampzilla/go/src/github.com/stampzilla/stampzilla-go/nodes/stampzilla-enocean/main.go:95 +0xa6
created by main.main
        /home/stampzilla/go/src/github.com/stampzilla/stampzilla-go/nodes/stampzilla-enocean/main.go:36 +0x27c
jonaz commented 9 years ago

Solution check if device is nil here: https://github.com/stampzilla/stampzilla-go/blob/master/nodes/stampzilla-enocean/main.go#L122