From d2f364f0868a09f074aa159faa866bf05d054341 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Fri, 4 Mar 2022 17:52:44 -0700 Subject: [PATCH] Correctly identify when time is past end of thrustcurve so thrust is 0 in getAverageThrust This has been lurking -- we're not actually supposed to be calling getAverageThrustThrust when we're past the end of the thrustcurve (there's a test for whether the motor is active before calling it), but another bug in the parallel staging code exposed it. --- core/src/net/sf/openrocket/motor/ThrustCurveMotor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java index 904b87053..51f78e511 100644 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java +++ b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java @@ -338,11 +338,11 @@ public class ThrustCurveMotor implements Motor, Comparable, Se int timeIndex = 0; - while( timeIndex < time.length-2 && startTime > time[timeIndex+1] ) { + while( timeIndex < time.length-1 && startTime > time[timeIndex+1] ) { timeIndex++; } - if ( timeIndex == time.length ) { + if ( timeIndex == time.length-1 ) { return 0.0; }