Skip to content

Fix division-by-0 crash from 100% gamepad deadzones, and lack of input from 0% deadzones

This merge request fixes a division-by-0 crash when using a gamepad deadzone of 100%.

The problem was that it checked if the hypotenuse of the X and Y axes was more than the deadzone, then lowered the hypotenuse to 100%, then subtracted the deadzone from the hypotenuse, then divided something by that, without checking if that was then 0, allowing division by 0 if the deadzone was 100%.

This merge request fixes that by making it so that if the deadzone is 100%, it'll just return 100% input if the user uses that much axis power.

This merge request additionally also fixes a deadzone of 0% resulting in no axis input at all.

Edited by Zwip-Zwap Zapony

Merge request reports

Loading