From 63debb7d633ee2a433af91c698f649377e8b999e Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Sat, 5 Jun 2021 16:18:58 +0200 Subject: [PATCH] Carriers: fix dialog nasal Prevent nil dereference when empty nodes do not have a valid name node. --- gui/dialogs/clemenceau.xml | 6 +++--- gui/dialogs/eisenhower.xml | 6 +++--- gui/dialogs/nimitz.xml | 6 +++--- gui/dialogs/san_antonio.xml | 6 +++--- gui/dialogs/truman.xml | 6 +++--- gui/dialogs/vinson.xml | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/gui/dialogs/clemenceau.xml b/gui/dialogs/clemenceau.xml index ad8a9dc1c..260abc51c 100644 --- a/gui/dialogs/clemenceau.xml +++ b/gui/dialogs/clemenceau.xml @@ -62,7 +62,7 @@ var v = getprop("/controls/clemenceau/turn-to-launch-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Clemenceau") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Clemenceau") { c.getNode("controls/turn-to-launch-hdg").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); @@ -92,7 +92,7 @@ var v = getprop("/controls/clemenceau/turn-to-recovery-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Clemenceau") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Clemenceau") { c.getNode("controls/turn-to-recovery-hdg").setBoolValue(v); c.getNode("controls/turn-to-launch-hdg").setBoolValue(0); @@ -122,7 +122,7 @@ var v = getprop("/controls/clemenceau/turn-to-base-course"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Clemenceau") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Clemenceau") { c.getNode("controls/turn-to-base-course").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); diff --git a/gui/dialogs/eisenhower.xml b/gui/dialogs/eisenhower.xml index 9710038bc..005dcc59c 100644 --- a/gui/dialogs/eisenhower.xml +++ b/gui/dialogs/eisenhower.xml @@ -62,7 +62,7 @@ var v = getprop("/controls/eisenhower/turn-to-launch-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Eisenhower") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Eisenhower") { c.getNode("controls/turn-to-launch-hdg").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); @@ -92,7 +92,7 @@ var v = getprop("/controls/eisenhower/turn-to-recovery-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Eisenhower") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Eisenhower") { c.getNode("controls/turn-to-recovery-hdg").setBoolValue(v); c.getNode("controls/turn-to-launch-hdg").setBoolValue(0); @@ -122,7 +122,7 @@ var v = getprop("/controls/eisenhower/turn-to-base-course"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Eisenhower") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Eisenhower") { c.getNode("controls/turn-to-base-course").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); diff --git a/gui/dialogs/nimitz.xml b/gui/dialogs/nimitz.xml index 648e61512..c48d6ce33 100644 --- a/gui/dialogs/nimitz.xml +++ b/gui/dialogs/nimitz.xml @@ -62,7 +62,7 @@ var v = getprop("/controls/nimitz/turn-to-launch-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Nimitz") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Nimitz") { c.getNode("controls/turn-to-launch-hdg").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); @@ -92,7 +92,7 @@ var v = getprop("/controls/nimitz/turn-to-recovery-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Nimitz") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Nimitz") { c.getNode("controls/turn-to-recovery-hdg").setBoolValue(v); c.getNode("controls/turn-to-launch-hdg").setBoolValue(0); @@ -122,7 +122,7 @@ var v = getprop("/controls/nimitz/turn-to-base-course"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Nimitz") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Nimitz") { c.getNode("controls/turn-to-base-course").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); diff --git a/gui/dialogs/san_antonio.xml b/gui/dialogs/san_antonio.xml index 2ed027cd7..d21035609 100644 --- a/gui/dialogs/san_antonio.xml +++ b/gui/dialogs/san_antonio.xml @@ -62,7 +62,7 @@ var v = getprop("/controls/sanantonio/turn-to-launch-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "San Antonio") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "San Antonio") { c.getNode("controls/turn-to-launch-hdg").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); @@ -92,7 +92,7 @@ var v = getprop("/controls/sanantonio/turn-to-recovery-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "San Antonio") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "San Antonio") { c.getNode("controls/turn-to-recovery-hdg").setBoolValue(v); c.getNode("controls/turn-to-launch-hdg").setBoolValue(0); @@ -122,7 +122,7 @@ var v = getprop("/controls/sanantonio/turn-to-base-course"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "San Antonio") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "San Antonio") { c.getNode("controls/turn-to-base-course").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); diff --git a/gui/dialogs/truman.xml b/gui/dialogs/truman.xml index 15cc5243e..d9d172c67 100644 --- a/gui/dialogs/truman.xml +++ b/gui/dialogs/truman.xml @@ -62,7 +62,7 @@ var v = getprop("/controls/truman/turn-to-launch-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Truman") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Truman") { c.getNode("controls/turn-to-launch-hdg").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); @@ -92,7 +92,7 @@ var v = getprop("/controls/truman/turn-to-recovery-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Truman") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Truman") { c.getNode("controls/turn-to-recovery-hdg").setBoolValue(v); c.getNode("controls/turn-to-launch-hdg").setBoolValue(0); @@ -121,7 +121,7 @@ var v = getprop("/controls/truman/turn-to-base-course"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Truman") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Truman") { c.getNode("controls/turn-to-base-course").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); diff --git a/gui/dialogs/vinson.xml b/gui/dialogs/vinson.xml index 3288cfc9c..99062292d 100644 --- a/gui/dialogs/vinson.xml +++ b/gui/dialogs/vinson.xml @@ -62,7 +62,7 @@ var v = getprop("/controls/vinson/turn-to-launch-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Vinson") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Vinson") { c.getNode("controls/turn-to-launch-hdg").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0); @@ -92,7 +92,7 @@ var v = getprop("/controls/vinson/turn-to-recovery-hdg"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Vinson") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Vinson") { c.getNode("controls/turn-to-recovery-hdg").setBoolValue(v); c.getNode("controls/turn-to-launch-hdg").setBoolValue(0); @@ -122,7 +122,7 @@ var v = getprop("/controls/vinson/turn-to-base-course"); foreach (var c; props.globals.getNode("/ai/models").getChildren("carrier")){ - if (c.getNode("name").getValue() == "Vinson") + if (c.getNode("name").getValue() != nil and c.getNode("name").getValue() == "Vinson") { c.getNode("controls/turn-to-base-course").setBoolValue(v); c.getNode("controls/turn-to-recovery-hdg").setBoolValue(0);