pas2js: createSafeCallback: return null for null

This commit is contained in:
mattias 2023-05-13 11:24:38 +02:00 committed by Pierre Muller
parent 0211c085e9
commit 5776f6ad21

View File

@ -248,6 +248,7 @@ var rtl = {
createSafeCallback: function(scope, fn){
var cb;
if (typeof(fn)==='string'){
if (!scope[fn]) return null;
if (!scope.hasOwnProperty('$events')) scope.$events = {};
cb = scope.$events[fn];
if (cb) return cb;
@ -258,6 +259,8 @@ var rtl = {
if (!rtl.handleUncaughtException(err)) throw err;
}
};
} else if(!fn) {
return null;
} else {
cb = function(){
try{