Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: mcdu radio navigation page crash randomly #86

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class RadNavPage : MCDUPage {
private NavSelector _vor1;
private NavSelector _vor2;

private bool _initialized;

private void Start() {
_fmgc = DependenciesInjector.GetInstance(this).fmgc;

Expand All @@ -22,6 +24,8 @@ private void Start() {
_vor2 = _fmgc.radNav.VOR2;
_ils = _fmgc.radNav.ILS;
_adf = _fmgc.radNav.ADF;

_initialized = true;
}

public override void OnPageInit(MCDU mcdu) {
Expand All @@ -37,6 +41,8 @@ public override void OnPageUpdate() {
}

private void UpdateUI() {
if (!_initialized) return;

_mcdu.l1Label.text = "VOR1/FREQ";
_mcdu.l1Text.text =
$"<color=#30FFFF>{_vor1.Identity ?? "[ ]"}/{(_vor1.Index != -1 ? _navaidDatabase.frequencies[_vor1.Index].ToString("F") : "[ . ]")}</color>";
Expand Down