Skip to content

fix: replace bitwise OR with logical OR in gamepad connection check#529

Open
Xutzu11 wants to merge 1 commit into
agateau:masterfrom
Xutzu11:master
Open

fix: replace bitwise OR with logical OR in gamepad connection check#529
Xutzu11 wants to merge 1 commit into
agateau:masterfrom
Xutzu11:master

Conversation

@Xutzu11

@Xutzu11 Xutzu11 commented Apr 26, 2026

Copy link
Copy Markdown

In onGamepadConnected(), the condition used a bitwise OR (|) instead of a logical OR (||). This forces the evaluation of hasEnoughInputs() even when mInputCount == 0 is already true.

Switching to a logical OR enables short-circuit evaluation, preventing unnecessary method execution and potential side effects. Found via SonarQube analysis.

In `onGamepadConnected()`, the condition used a bitwise OR (`|`) instead of a logical OR (`||`). This forces the evaluation of `hasEnoughInputs()` even when `mInputCount == 0` is already true.

Switching to a logical OR enables short-circuit evaluation, preventing unnecessary method execution and potential side effects. Found via SonarQube analysis.
@Xutzu11

Xutzu11 commented May 9, 2026

Copy link
Copy Markdown
Author

@agateau @mirceamaierean I found a small bug on the project using a program verification tool, it would help me a lot if you could please review it and merge if it's all correct, thanks!

@mirceamaierean mirceamaierean left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, waiting for checks to clear, and can be merged

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

Successfully merging this pull request may close these issues.

2 participants