diff options
| author | dann-merlin <55287004+dann-merlin@users.noreply.github.com> | 2023-04-16 00:27:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-16 01:27:14 +0100 |
| commit | c86f06caa0be207882266947da67125177bba5af (patch) | |
| tree | 4e22553fc863da0cf72ae26e85101a9acc12ef8e /src/helpers/Vector2D.cpp | |
| parent | afc887d94123ba5e5f715839c4aba43daf0c7804 (diff) | |
Fix possible usage of clamp with lo > hi in Vector2D (#2049)
Diffstat (limited to 'src/helpers/Vector2D.cpp')
| -rw-r--r-- | src/helpers/Vector2D.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/helpers/Vector2D.cpp b/src/helpers/Vector2D.cpp index afd8b22a..2baa7353 100644 --- a/src/helpers/Vector2D.cpp +++ b/src/helpers/Vector2D.cpp @@ -29,7 +29,7 @@ Vector2D Vector2D::floor() { } Vector2D Vector2D::clamp(const Vector2D& min, const Vector2D& max) { - return Vector2D(std::clamp(this->x, min.x, max.x == 0 ? INFINITY : max.x), std::clamp(this->y, min.y, max.y == 0 ? INFINITY : max.y)); + return Vector2D(std::clamp(this->x, min.x, max.x < min.x ? INFINITY : max.x), std::clamp(this->y, min.y, max.y < min.y ? INFINITY : max.y)); } double Vector2D::distance(const Vector2D& other) { |
