2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #11031 from german77/zero

input_common: Avoid potential division by zero
This commit is contained in:
liamwhite 2023-07-06 18:57:07 -04:00 committed by GitHub
commit 95c5b715b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,8 +160,9 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
last_mouse_change.y += mouse_change.y * y_sensitivity; last_mouse_change.y += mouse_change.y * y_sensitivity;
// Bind the mouse change to [0 <= deadzone_counterweight <= 1.0] // Bind the mouse change to [0 <= deadzone_counterweight <= 1.0]
if (last_mouse_change.Length() < deadzone_counterweight) { const float length = last_mouse_change.Length();
last_mouse_change /= last_mouse_change.Length(); if (length < deadzone_counterweight && length != 0.0f) {
last_mouse_change /= length;
last_mouse_change *= deadzone_counterweight; last_mouse_change *= deadzone_counterweight;
} }