42wim / matterircd

Connect to your mattermost or slack using your IRC-client of choice.
MIT License
294 stars 60 forks source link

Handle SIGSEGV nil pointer for event.ParentUser #412

Closed hloeung closed 3 years ago

hloeung commented 3 years ago

@axinojolais ran into this issue where matterircd crashed with SIGSEGV:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x46cd00]

goroutine 50 [running]:
github.com/42wim/matterircd/mm-go-irckit.(*User).handleReactionEvent(0xc0000b09a0, 0x4c7820, 0xc0002c0960)
        /home/matterircd/go/src/github.com/42wim/matterircd/mm-go-irckit/userbridge.go:370 +0x360
github.com/42wim/matterircd/mm-go-irckit.(*User).handleEventChan(0xc0000b09a0)
        /home/matterircd/go/src/github.com/42wim/matterircd/mm-go-irckit/userbridge.go:95 +0x17e
created by github.com/42wim/matterircd/mm-go-irckit.(*User).loginTo
        /home/matterircd/go/src/github.com/42wim/matterircd/mm-go-irckit/userbridge.go:814 +0x1b4

Not sure what triggered it, but this should guard and hopefully prevent crashes of this type.

42wim commented 3 years ago

:+1: