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
This commit is contained in:
Virt 2024-07-10 15:16:17 +02:00
commit 527804e49c

View file

@ -19,6 +19,8 @@ SModeResult CModeRotate::update(Vector2D pos) {
// normalize // normalize
double size = end.size(); double size = end.size();
if (size == 0) size = 1; // do not divide by 0
end.x /= size; end.x /= size;
end.y /= size; end.y /= size;