diff --git a/src/raymath.h b/src/raymath.h index 539617ff9..f32d0553d 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -397,7 +397,7 @@ RMAPI Vector2 Vector2Normalize(Vector2 v) RMAPI Vector2 Vector2Limit(Vector2 v, float limit) { Vector2 result = {v.x, x.y}; float length = sqrtf((v.x * v.x) + (v.y * v.y)) - if (length > limit) { + if (length > limit && limit > 0) { float ilength = 1.0f/length; result.x = v.x*ilength*limit; result.y = v.y*ilength*limit;