Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7aab5a1f authored by John Reck's avatar John Reck
Browse files

Add negative guard

 Bug: 15631600

Change-Id: Idd7740f58876e73694fafb8ef55ebaff511f6dca
parent 9285d1bf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ float LUTInterpolator::interpolate(float input) {
    int i1 = (int) ipart;
    int i2 = MathUtils::min(i1 + 1, mSize - 1);

    LOG_ALWAYS_FATAL_IF(i1 < 0 || i2 < 0, "negatives in interpolation!"
            " i1=%d, i2=%d, input=%f, lutpos=%f, size=%zu, values=%p, ipart=%f, weight=%f",
            i1, i2, input, lutpos, mSize, mValues, ipart, weight);

    float v1 = mValues[i1];
    float v2 = mValues[i2];