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

Unhandled game controller button events cause a panic #1154

Closed
potatotech opened this issue Oct 6, 2021 · 1 comment · Fixed by #1156
Closed

Unhandled game controller button events cause a panic #1154

potatotech opened this issue Oct 6, 2021 · 1 comment · Fixed by #1156

Comments

@potatotech
Copy link
Contributor

potatotech commented Oct 6, 2021

SDL2 has some undocumented button types for game controllers.
Currently, these are:

SDL_CONTROLLER_BUTTON_MISC1
SDL_CONTROLLER_BUTTON_PADDLE1
SDL_CONTROLLER_BUTTON_PADDLE2
SDL_CONTROLLER_BUTTON_PADDLE3
SDL_CONTROLLER_BUTTON_PADDLE4
SDL_CONTROLLER_BUTTON_TOUCHPAD

Although they are present in the automatically-generated bindings, they have no defined equivalent in the safe bindings.

When these button events appear, the following line causes a panic:

_ => panic!("unhandled controller button"),

This is the root cause of #1128.

@Cobrand
Copy link
Member

Cobrand commented Oct 10, 2021

Yeah panicking it a terrible idea, just return None in those cases (or better: implement them). It's not really a bug since it's expected, but it should be fixed nonetheless.

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

Successfully merging a pull request may close this issue.

2 participants