pas2js: createSafeCallback: return null for null

This commit is contained in:
mattias 2023-05-13 11:24:38 +02:00
parent 5f757a2313
commit 1066a0dbfd

View File

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