1
0
Fork 0

prop-key-handler.nas: check for nil property

tutorial.nas, globals.nas, controls.nas: cosmetics
This commit is contained in:
mfranz 2007-11-20 17:02:13 +00:00
parent 93b06dc514
commit ecf469e295
4 changed files with 4 additions and 4 deletions

View file

@ -391,7 +391,7 @@ var ptt = func(b) setprop("/instrumentation/comm/ptt", b);
##
# Lighting
#
var toggleLights = func () {
var toggleLights = func {
if (getprop("/controls/switches/panel-lights")) {
setprop("/controls/switches/panel-lights-factor", 0);
setprop("/controls/switches/panel-lights", 0);

View file

@ -71,7 +71,7 @@ var interpolate = func(node, val...) {
# "always trigger on write" (1), and "trigger even when children are
# written to" (2).
#
var setlistener = func(node, fun, init=0, runtime=1) {
var setlistener = func(node, fun, init = 0, runtime = 1) {
if(isa(node, props.Node)) node = node._g;
var id = _setlistener(node, func {
arg[0] = props.wrapNode(arg[0]);

View file

@ -125,7 +125,7 @@ var handle_key = func(key, shift) {
input = complete(explicit_input, shift ? -1 : 1);
build_completion(explicit_input);
var n = call(func { props.globals.getNode(input) }, [], var err = []);
if (!size(err) and n.getAttribute("children") and size(completion) == 1)
if (!size(err) and n != nil and n.getAttribute("children") and size(completion) == 1)
handle_key(`/`, 0);
}

View file

@ -84,7 +84,7 @@ var startTutorial = func {
var presets = tutorialN.getChild("presets");
if (presets != nil) {
props.copy(presets, props.globals.getNode("/sim/presets"));
fgcommand("presets-commit", props.Node.new());
fgcommand("presets-commit");
if (getprop("/sim/presets/on-ground")) {
var eng = props.globals.getNode("/controls/engines");