[fixes #358] Fix Booster deletion

This commit is contained in:
SiboVG 2022-02-19 13:01:48 +01:00
parent e8a2fbf449
commit 91b93debec
2 changed files with 4 additions and 3 deletions

View File

@ -208,7 +208,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
return true;
}
return stages.get(stageNumber).active;
return stages.get(stageNumber) != null && stages.get(stageNumber).active;
}
public Collection<RocketComponent> getAllComponents() {

View File

@ -25,6 +25,7 @@ import net.sf.openrocket.gui.util.Icons;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
import net.sf.openrocket.rocketcomponent.ParallelStage;
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.AxialStage;
@ -176,8 +177,8 @@ public class RocketActions {
if (c instanceof Rocket)
return false;
// Cannot remove last stage
if ((c instanceof AxialStage) && (c.getParent().getChildCount() == 1)) {
// Cannot remove last stage, except from Boosters
if ((c instanceof AxialStage) && !(c instanceof ParallelStage) && (c.getParent().getChildCount() == 1)) {
return false;
}