patch up division by zero issue on normalizing Length
only normalizing length when its >0, not sure if there is something better we can do here.
Diffs=
8b7dd980b patch up division by zero issue on normalizing Length (#6095)
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
diff --git a/.rive_head b/.rive_head
index ed15abf..70cb24c 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-8c99c8dcf67c5bf80bba1ca953d3e3dfa591e6d7
+8b7dd980b88815f42ee177dcda7f96dd194226fa
diff --git a/include/rive/math/vec2d.hpp b/include/rive/math/vec2d.hpp
index 7e34fbd..51afdd7 100644
--- a/include/rive/math/vec2d.hpp
+++ b/include/rive/math/vec2d.hpp
@@ -22,8 +22,11 @@
float normalizeLength()
{
const float len = this->length();
- x /= len;
- y /= len;
+ if (len > 0)
+ {
+ x /= len;
+ y /= len;
+ }
return len;
}