old-knossos
old-knossos copied to clipboard
joystick indexing bug
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.
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.
Yeah, I (or someone) will need to do some digging to figure out what ngld was trying to do here.