From 1aedeeeacde744072617a8e1e4b53b868e0cdd01 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Wed, 29 May 2019 16:47:14 -0500 Subject: [PATCH] Check for nulls in view (fixes #18) --- src/TransferView.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/TransferView.cs b/src/TransferView.cs index b502c6b..bc8e2c7 100644 --- a/src/TransferView.cs +++ b/src/TransferView.cs @@ -225,7 +225,7 @@ public bool Refresh() private bool showLoadingText { get { return timeToWait == null - || model.ejectionBurn.atTime == null + || model.ejectionBurn?.atTime == null || model.ejectionBurn.atTime < Planetarium.GetUniversalTime(); } } @@ -246,7 +246,7 @@ private bool showLoadingText { public string getYearValue() { Refresh(); - yearFormatter.Update(timeToWait.years); + yearFormatter.Update(timeToWait?.years); return yearFormatter.ToString(); } @@ -256,7 +256,7 @@ public string getYearValue() public string getDayValue() { Refresh(); - dayFormatter.Update(timeToWait.days); + dayFormatter.Update(timeToWait?.days); return dayFormatter.ToString(); } @@ -266,7 +266,7 @@ public string getDayValue() public string getHourValue() { Refresh(); - hourFormatter.Update(timeToWait.hours); + hourFormatter.Update(timeToWait?.hours); return hourFormatter.ToString(); } @@ -276,7 +276,7 @@ public string getHourValue() public string getMinuteValue() { Refresh(); - minuteFormatter.Update(timeToWait.minutes); + minuteFormatter.Update(timeToWait?.minutes); return minuteFormatter.ToString(); } @@ -286,7 +286,7 @@ public string getMinuteValue() public string getSecondValue() { Refresh(); - secondFormatter.Update(timeToWait.seconds); + secondFormatter.Update(timeToWait?.seconds); return secondFormatter.ToString(); } @@ -296,8 +296,8 @@ public string getSecondValue() public string getDeltaV() { Refresh(); - double dv = (model.planeChangeBurn == null || !Settings.Instance.AddPlaneChangeDeltaV) - ? model.ejectionBurn.totalDeltaV + double? dv = (model.planeChangeBurn == null || !Settings.Instance.AddPlaneChangeDeltaV) + ? model.ejectionBurn?.totalDeltaV : model.ejectionBurn.totalDeltaV + model.planeChangeBurn.totalDeltaV; deltaVFormatter.Update(dv); return deltaVFormatter.ToString();