setlistener: tolerate being call()-ed
Fix bug https://sourceforge.net/p/flightgear/codetickets/2219/ Changes to logging mean than setlistener breaks when invoked via call(), which occurs in the Warthog Nasal scripting. The problem is that call() forces caller() to return nil, which the setlistener() debug code did not check for.
This commit is contained in:
parent
7d78937a4c
commit
f074504326
1 changed files with 4 additions and 1 deletions
|
@ -118,8 +118,11 @@ var setlistener = func(node, fn, init = 0, runtime = 1) {
|
|||
var id = _setlistener(node, func(chg, lst, mode, is_child) {
|
||||
fn(props.wrapNode(chg), props.wrapNode(lst), mode, is_child);
|
||||
}, init, runtime);
|
||||
|
||||
var c = caller();
|
||||
logprint(LOG_DEBUG, "setting listener #",id," in ",c[2],":",c[3]);
|
||||
if (c != nil) {
|
||||
logprint(LOG_DEBUG, "setting listener #",id," in ",c[2],":",c[3]);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue