diff --git a/src/core/spectrum.cpp b/src/core/spectrum.cpp index 06fc4a7d38..59770855d0 100644 --- a/src/core/spectrum.cpp +++ b/src/core/spectrum.cpp @@ -1267,7 +1267,7 @@ void ResampleLinearSpectrum(const Float *lambdaIn, const Float *vIn, int nIn, // Linear search from the starting point. (Presumably more // efficient than a binary search from scratch, or doesn't // matter either way.) - end = start; + end = start > 0 ? start : 0; while (end < nIn && lambda + delta > lambdaIn[end]) ++end; }