From a7673fd293f642aeb731e7b73b8481608c0db27e Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 24 Jul 2023 11:05:43 +0200 Subject: [PATCH] [#2270] Only check axial stages for upper stage, not boosters --- .../sf/openrocket/rocketcomponent/AxialStage.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java b/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java index b4d3ac47e..249f8dfeb 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java +++ b/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java @@ -170,14 +170,14 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC * @return the previous stage in the rocket */ public AxialStage getUpperStage() { - if( null == this.parent ) { + if (this.parent == null) { return null; - }else if(Rocket.class.isAssignableFrom(this.parent.getClass()) ){ - final int thisIndex = getStageNumber(); - if( 0 < thisIndex ){ - return (AxialStage)parent.getChild(thisIndex-1); + } else if (Rocket.class.isAssignableFrom(this.parent.getClass())) { + final int thisIndex = parent.getChildPosition(this); + if (thisIndex > 0) { + return (AxialStage) parent.getChild(thisIndex-1); } - }else { + } else { return this.parent.getStage(); } return null;