summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-07-07 00:57:07 +0200
committerGitHub <noreply@github.com>2023-07-07 00:57:07 +0200
commit95c5b715b18174d4dedaa415004e99040d5f71ef (patch)
tree2dbfacffcfea5df73e77c149c62b63a72f850334 /src
parentvfs_real: use open file size for getting size (#11016) (diff)
parentinput_common: Avoid potential division by zero (diff)
downloadyuzu-95c5b715b18174d4dedaa415004e99040d5f71ef.tar
yuzu-95c5b715b18174d4dedaa415004e99040d5f71ef.tar.gz
yuzu-95c5b715b18174d4dedaa415004e99040d5f71ef.tar.bz2
yuzu-95c5b715b18174d4dedaa415004e99040d5f71ef.tar.lz
yuzu-95c5b715b18174d4dedaa415004e99040d5f71ef.tar.xz
yuzu-95c5b715b18174d4dedaa415004e99040d5f71ef.tar.zst
yuzu-95c5b715b18174d4dedaa415004e99040d5f71ef.zip
Diffstat (limited to '')
-rw-r--r--src/input_common/drivers/mouse.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index dac29c78f..9fb824baf 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -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;
// Bind the mouse change to [0 <= deadzone_counterweight <= 1.0]
- if (last_mouse_change.Length() < deadzone_counterweight) {
- last_mouse_change /= last_mouse_change.Length();
+ const float length = last_mouse_change.Length();
+ if (length < deadzone_counterweight && length != 0.0f) {
+ last_mouse_change /= length;
last_mouse_change *= deadzone_counterweight;
}