diff --git a/src/track/beatgrid.cpp b/src/track/beatgrid.cpp index 99b279cbee89..d9d43033fc94 100644 --- a/src/track/beatgrid.cpp +++ b/src/track/beatgrid.cpp @@ -141,13 +141,17 @@ bool BeatGrid::isValid() const { // This could be implemented in the Beats Class itself. // If necessary, the child class can redefine it. double BeatGrid::findNextBeat(double dSamples) const { - return findNthBeat(dSamples, +1); + const double position = findNthBeat(dSamples, +1); + DEBUG_ASSERT(position >= dSamples || position == -1); + return position; } // This could be implemented in the Beats Class itself. // If necessary, the child class can redefine it. double BeatGrid::findPrevBeat(double dSamples) const { - return findNthBeat(dSamples, -1); + const double position = findNthBeat(dSamples, -1); + DEBUG_ASSERT(position <= dSamples); + return position; } // This is an internal call. This could be implemented in the Beats Class itself.