layeh / gumble

gumble is a Mumble client implementation in Go (golang)
https://pkg.go.dev/mod/layeh.com/gumble
Mozilla Public License 2.0
173 stars 53 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #22

Closed erolg closed 8 years ago

erolg commented 8 years ago

Hi, I try to work barnard (but w/o uiterm package). When I call the VoiceToggle function. I got this exception. Do you have any idea why it occurs?

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x14 pc=0x1dd36c]

goroutine 1 [running]:
panic(0x366000, 0x56c5e038)
    /usr/local/go/src/runtime/panic.go:481 +0x330
github.com/layeh/gumble/gumbleopenal.(*Stream).StopSource(0x0, 0x0, 0x0)
    /home/pi/go/src/github.com/layeh/gumble/gumbleopenal/gumble_openal.go:71 +0x20
_/home/pi/loli.(*Barnard).VoiceToggle(0x56cc2c40)
    /home/pi/loli/client.go:99 +0x30
_/home/pi/loli.(*Barnard).Initialize(0x56cc2c40)
    /home/pi/loli/init.go:45 +0x1b8
_/home/pi/loli.(*Barnard).Run(0x56cc2c40)
    /home/pi/loli/init.go:11 +0x1c
main.main()
    /home/pi/loli/cmd/barnard/main.go:57 +0x5e8
exit status 2
ghost commented 8 years ago

The error message indicates that Barnard.Stream is nil (i.e. hasn't been initialized with gumbleopenal.New(b.Client)). You can see where this is done: https://github.com/layeh/barnard/blob/master/client.go#L28

Ensure that you correct create the gumbleopenal stream.