From ae0a6357168465ee8d280233631719763cb66b08 Mon Sep 17 00:00:00 2001 From: Brenno Date: Mon, 24 May 2021 11:32:34 -0300 Subject: [PATCH] removed assert from interpolation --- src/KeyFrame.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index 048ef9313..4107f2def 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -94,8 +94,14 @@ namespace openshot{ } // Interpolate two points using the right Point's interpolation method double InterpolateBetween(Point const & left, Point const & right, double target, double allowed_error) { - assert(left.co.X < target); - assert(target <= right.co.X); + // check if target is outside of the extremities poits + // This can occur when moving fast the play head + if(left.co.X > target){ + return left.co.Y; + } + if(target > right.co.X){ + return right.co.Y; + } switch (right.interpolation) { case CONSTANT: return left.co.Y; case LINEAR: return InterpolateLinearCurve(left, right, target);