Skip to content

Commit

Permalink
Check for nulls in view (fixes #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed May 29, 2019
1 parent 07d78df commit 1aedeee
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/TransferView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand All @@ -246,7 +246,7 @@ private bool showLoadingText {
public string getYearValue()
{
Refresh();
yearFormatter.Update(timeToWait.years);
yearFormatter.Update(timeToWait?.years);
return yearFormatter.ToString();
}

Expand All @@ -256,7 +256,7 @@ public string getYearValue()
public string getDayValue()
{
Refresh();
dayFormatter.Update(timeToWait.days);
dayFormatter.Update(timeToWait?.days);
return dayFormatter.ToString();
}

Expand All @@ -266,7 +266,7 @@ public string getDayValue()
public string getHourValue()
{
Refresh();
hourFormatter.Update(timeToWait.hours);
hourFormatter.Update(timeToWait?.hours);
return hourFormatter.ToString();
}

Expand All @@ -276,7 +276,7 @@ public string getHourValue()
public string getMinuteValue()
{
Refresh();
minuteFormatter.Update(timeToWait.minutes);
minuteFormatter.Update(timeToWait?.minutes);
return minuteFormatter.ToString();
}

Expand All @@ -286,7 +286,7 @@ public string getMinuteValue()
public string getSecondValue()
{
Refresh();
secondFormatter.Update(timeToWait.seconds);
secondFormatter.Update(timeToWait?.seconds);
return secondFormatter.ToString();
}

Expand All @@ -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();
Expand Down

0 comments on commit 1aedeee

Please sign in to comment.