Account for undefined before/afterListeners
This commit is contained in:
parent
630ae6b6cd
commit
6ccc5a62bf
|
@ -637,12 +637,12 @@ Model.nestRemoting = function(relationName, options, cb) {
|
|||
var before = method.isStatic ? beforeListeners : beforeListeners['prototype'];
|
||||
var after = method.isStatic ? afterListeners : afterListeners['prototype'];
|
||||
var m = method.isStatic ? method.name : 'prototype.' + method.name;
|
||||
if (before[delegateTo]) {
|
||||
if (before && before[delegateTo]) {
|
||||
self.beforeRemote(m, function(ctx, result, next) {
|
||||
before[delegateTo]._listeners.call(null, ctx, next);
|
||||
});
|
||||
}
|
||||
if (after[delegateTo]) {
|
||||
if (after && after[delegateTo]) {
|
||||
self.afterRemote(m, function(ctx, result, next) {
|
||||
after[delegateTo]._listeners.call(null, ctx, next);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue