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

joystick indexing bug #214

Open
Goober5000 opened this issue Oct 15, 2020 · 2 comments
Open

joystick indexing bug #214

Goober5000 opened this issue Oct 15, 2020 · 2 comments
Labels

Comments

@Goober5000
Copy link
Collaborator

This was spotted by qazwsxal on Discord. This is in runner.py, lines 216-222:

                elif len(candidates) == 0:
                    if len(flags['joysticks']) > sel_id:
                        logging.warning('Mapping joystick %s => %s (based on index)', sel_guid, candidates[sel_id]['guid'])

                        cfg['fso']['joystick_guid'] = candidates[sel_id]['guid']
                    else:
                        logging.error('Joystick mapping failed!')

Notice that the code is indexing into a proven zero-length array.

@Goober5000 Goober5000 added the bug label Oct 15, 2020
@Goober5000
Copy link
Collaborator Author

Goober5000 commented Oct 15, 2020

I can't really tell if the 0-length check is correct and the code is wrong, or if the test should be != 0 instead. I lean toward it should be != 0, but someone more knowledgeable with the code should check.

@jg18
Copy link
Collaborator

jg18 commented Oct 20, 2020

Yeah, I (or someone) will need to do some digging to figure out what ngld was trying to do here.

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

No branches or pull requests

2 participants