Catch booster mount being null

This commit is contained in:
SiboVG 2023-04-04 14:14:41 +02:00
parent 485c23161e
commit bcaf345bec

View File

@ -240,10 +240,14 @@ public class SimulationDTO {
calc = MassCalculator.calculateStructure(CGCalcConfig); calc = MassCalculator.calculateStructure(CGCalcConfig);
// Get booster1 motor mass // Get booster1 motor mass
double booster1MotorMass = 0;
MotorMount booster1Mount = mounts.get((AxialStage) rocket.getChild(1)); MotorMount booster1Mount = mounts.get((AxialStage) rocket.getChild(1));
MotorConfiguration booster1Config = booster1Mount.getMotorConfig(fcid); Motor booster1Motor = null;
Motor booster1Motor = booster1Config.getMotor(); if (booster1Mount != null) {
double booster1MotorMass = booster1Motor != null ? booster1Motor.getLaunchMass() : 0; MotorConfiguration booster1Config = booster1Mount.getMotorConfig(fcid);
booster1Motor = booster1Config.getMotor();
booster1MotorMass = booster1Motor != null ? booster1Motor.getLaunchMass() : 0;
}
// Set mass // Set mass
double booster2Mass = calc.getMass() + motorMass + sustainerMotorMass + booster1MotorMass; double booster2Mass = calc.getMass() + motorMass + sustainerMotorMass + booster1MotorMass;