diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-17 18:37:14 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-17 18:37:14 +0200 |
| commit | 473d4591b095299ed14de0cdc6d6fad6ea422a93 (patch) | |
| tree | 80feac80b1ba0da3350f1680a17349199acd0bcf /src/helpers/BezierCurve.cpp | |
| parent | df2215cef76773249d5267b018a4ff9c3079bdd7 (diff) | |
fix some memory issues
Diffstat (limited to 'src/helpers/BezierCurve.cpp')
| -rw-r--r-- | src/helpers/BezierCurve.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/helpers/BezierCurve.cpp b/src/helpers/BezierCurve.cpp index 54a18732..bdf2c4b1 100644 --- a/src/helpers/BezierCurve.cpp +++ b/src/helpers/BezierCurve.cpp @@ -60,8 +60,8 @@ float CBezierCurve::getYForPoint(float x) { } // in the name of performance i shall make a hack - const auto LOWERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * lowerT)]; - const auto UPPERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * upperT)]; + const auto LOWERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * lowerT), 0, 199)]; + const auto UPPERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * upperT), 0, 199)]; const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x); |
