diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp index 0a95e6ccc9..32248e6755 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp @@ -298,9 +298,10 @@ std::tuple, std::vector, std::vector> } else { - if ( !sourceValues.empty() ) + // The last point is added without interpolation. But MD can be smaller than the source range which + // leads to startIndex equal to endIndex: leave these cases as inf. + if ( !sourceValues.empty() && md >= sourceMds[0] ) { - // The last point is added without interpolation value = sourceValues.back(); } }