diff --git a/Nasal/globals.nas b/Nasal/globals.nas index 74b656698..e83cc0809 100644 --- a/Nasal/globals.nas +++ b/Nasal/globals.nas @@ -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; }