diff options
author | portix <portix@gmx.net> | 2012-07-16 20:29:22 +0200 |
---|---|---|
committer | portix <portix@gmx.net> | 2012-07-16 20:29:22 +0200 |
commit | 0590cc0222dafe8a22d015e112cb53c55a21d1ef (patch) | |
tree | 355250b358a755ef1c6385fdf25d4326c8d11521 /scripts | |
parent | e77273477f17148da1c95047ef48dda1e1ef2b64 (diff) | |
download | dwb-0590cc0222dafe8a22d015e112cb53c55a21d1ef.zip |
Check if second argument is a function in signals.connect before connecting to the signal
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/signals.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js index cec5e54a..9561d13d 100644 --- a/scripts/lib/signals.js +++ b/scripts/lib/signals.js @@ -29,14 +29,14 @@ value : (function () { var id = 0; return function(sig, func) { + if (func === null || typeof func !== "function") { + return -1; + } ++id; if (_registered[sig] === undefined || _registered[sig] === null) { _registered[sig] = []; signals[sig] = function () { return signals.emit(sig, arguments); }; } - if (func === null || typeof func !== "function") { - return -1; - } _registered[sig].push({callback : func, id : id, connected : true }); return id; }; |