From 527804e49cda9a546760c7caafdfb3aecc59edea Mon Sep 17 00:00:00 2001 From: Virt <41426325+VirtCode@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:16:17 +0200 Subject: [PATCH] fix: div by zero on rotate if cursor starts at 0;0 when the plugin is loaded whilst the cursor pos is at 0;0, the `end` vector is being normalized allthough it will contain 0;0. this will produce a division by zero, causing the rotation to be set to NaN, ultimately causing the cursor not to render because of a NaN'd projection matrix thanks for reporting and testing @RGBCube --- src/mode/ModeRotate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mode/ModeRotate.cpp b/src/mode/ModeRotate.cpp index 90c2b31..fc26983 100644 --- a/src/mode/ModeRotate.cpp +++ b/src/mode/ModeRotate.cpp @@ -19,6 +19,8 @@ SModeResult CModeRotate::update(Vector2D pos) { // normalize double size = end.size(); + if (size == 0) size = 1; // do not divide by 0 + end.x /= size; end.y /= size;