Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programm crashes when charging-grip is connected via USB #57

Open
dbaumgarten opened this issue Mar 1, 2019 · 0 comments
Open

Programm crashes when charging-grip is connected via USB #57

dbaumgarten opened this issue Mar 1, 2019 · 0 comments

Comments

@dbaumgarten
Copy link
Contributor

When i connect the charging-grip via usb (to charge my joycons while using them) the programm crashes on startup when the joycons are connected via bluetooth.

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

goroutine 1 [running]:
github.com/riking/joycon/prog4/consoleiface.(*Manager).SearchDevices(0xc42008a640, 0x0, 0x0)
	/home/daniel/go/src/github.com/riking/joycon/prog4/consoleiface/Manager.go:449 +0x6dc
github.com/riking/joycon/prog4/consoleiface.(*Manager).Run(0xc42008a640)
	/home/daniel/go/src/github.com/riking/joycon/prog4/consoleiface/Manager.go:77 +0x466
main.main()
	/home/daniel/go/src/github.com/riking/joycon/prog4/jcdriver/main.go:49 +0x32c

The reason seems to that this break:

cancels the for-loop without setting jc to a value.
And the line:

fmt.Println("[INFO] Connected to", jc.Type(), jc.Serial())

will then use jc (which is nil) and crashes.

Replacing the offending break with a continue does prevent the crash, but now the console spams the message "closing uinput 9 10 false".

Replacing the whole case-block for jcpc.JOYCON_PRODUCT_CHARGEGRIP with a continue does also get rid of the crash AND the message-spamming.

I am wondering why there is a block for the charging-grip? Is it more then just a charger? And what is the code in the case-block even supposed to do? Is it safe to remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant