Skip to content

Handle unknown gamepad rumble requests safely. - #25765

Merged
alice-i-cecile merged 2 commits into
bevyengine:mainfrom
Tatsuya0330:issue_25761
Sep 15, 2026
Merged

alice-i-cecile merged 2 commits into
bevyengine:mainfrom
Tatsuya0330:issue_25761

Conversation

@Tatsuya0330

@Tatsuya0330 Tatsuya0330 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Objective

Solution

  • Replaced .unwrap() on gamepads.get_gamepad_id(gamepad) with an explicit let-else check to safely handle cases where the gamepad ID is not found.
  • If the gamepad ID does not exist, handle_rumble_request now early-returns Err(RumbleError::GamepadNotFound) instead of panicking.

This PR was built by me with the assistance of Claude Sonnet 5.

@viridia

viridia commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

In accordance with Bevy's AI policy, if you used an LLM to create this PR, please add a disclosure in the description.

(The unit test, in particular, looks very much like the ones an LLM would generate).

Otherwise, looks pretty good!

@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy I-Crash A sudden unexpected crash S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it A-Input Player input via keyboard, mouse, gamepad, and more labels Sep 13, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Input Sep 13, 2026

@alice-i-cecile alice-i-cecile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the test is low-value here and should be cut :) This slow-changing simple code. Fix looks perfect though!

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Uncontroversial This work is generally agreed upon and removed S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Sep 13, 2026
@Tatsuya0330

Copy link
Copy Markdown
Contributor Author

@alice-i-cecile @viridia
Thank you for the review!
I made the following changes:

  • Added the LLM used for this work to the description.
  • Removed unknown gamepad rumble test.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Sep 14, 2026
@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Sep 15, 2026
Merged via the queue into bevyengine:main with commit 10ed841 Sep 15, 2026
40 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Input Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Input Player input via keyboard, mouse, gamepad, and more D-Trivial Nice and easy! A great choice to get started with Bevy I-Crash A sudden unexpected crash S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Rumble request panics if gamepad not found

3 participants