Skip to content

Commit

Permalink
fix: check for null for perf data (#8735)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saschl committed Jul 3, 2024
1 parent 6f34a3b commit 1a08470
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class CDUPerformancePage {
const transAlt = targetPlan.performanceData.transitionAltitude;
const transAltitudeIsFromDatabase = targetPlan.performanceData.transitionAltitudeIsFromDatabase;

if (transAlt !== undefined) {
if (transAlt !== null) {
transAltCell = `{cyan}${transAlt}{end}`;
if (transAltitudeIsFromDatabase) {
transAltCell += "[s-text]";
Expand All @@ -203,7 +203,7 @@ class CDUPerformancePage {
const eoAcc = plan.performanceData.engineOutAccelerationAltitude;
const eoAccPilot = plan.performanceData.engineOutAccelerationAltitudeIsPilotEntered;

const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== undefined ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== undefined ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;
const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== null ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== null ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;

mcdu.onLeftInput[4] = (value, scratchpadCallback) => {
if (mcdu.trySetThrustReductionAccelerationAltitude(value)) {
Expand All @@ -214,7 +214,7 @@ class CDUPerformancePage {
};

// eng out acceleration altitude
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== undefined ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== null ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;
mcdu.onRightInput[4] = (value, scratchpadCallback) => {
if (mcdu.trySetEngineOutAcceleration(value)) {
CDUPerformancePage.ShowTAKEOFFPage(mcdu);
Expand Down Expand Up @@ -849,7 +849,7 @@ class CDUPerformancePage {
if (hasDestination) {
const transitionLevel = plan.performanceData.transitionLevel;

if (transitionLevel !== undefined) {
if (transitionLevel !== null) {
transAltCell = (transitionLevel * 100).toFixed(0).padEnd(5, "\xa0");

if (plan.performanceData.transitionLevelIsFromDatabase) {
Expand Down Expand Up @@ -1019,8 +1019,8 @@ class CDUPerformancePage {
const eoAcc = plan.performanceData.missedEngineOutAccelerationAltitude;
const eoAccPilot = plan.performanceData.missedEngineOutAccelerationAltitudeIsPilotEntered;

const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== undefined ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== undefined ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== undefined ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;
const thrRedAcc = `{${thrRedPilot ? 'big' : 'small'}}${thrRed !== null ? thrRed.toFixed(0).padStart(5, '\xa0') : '-----'}{end}/{${accPilot ? 'big' : 'small'}}${acc !== null ? acc.toFixed(0).padEnd(5, '\xa0') : '-----'}{end}`;
const engOut = `{${eoAccPilot ? 'big' : 'small'}}${eoAcc !== null ? eoAcc.toFixed(0).padStart(5, '\xa0') : '-----'}{end}`;

mcdu.onLeftInput[4] = (value, scratchpadCallback) => {
if (mcdu.trySetThrustReductionAccelerationAltitudeGoaround(value)) {
Expand Down

0 comments on commit 1a08470

Please sign in to comment.