Account for undefined before/afterListeners

This commit is contained in:
Fabien Franzen 2014-08-22 22:18:24 +02:00
parent 630ae6b6cd
commit 6ccc5a62bf
1 changed files with 2 additions and 2 deletions

View File

@ -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);
});