mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
sanity check if a plugin's method was not found on hook call
This commit is contained in:
@@ -102,7 +102,15 @@ var fs = require('fs'),
|
||||
break;
|
||||
case 'action':
|
||||
async.each(hookList, function(hookObj) {
|
||||
_self.libraries[hookObj[0]][hookObj[1]].apply(_self.libraries[hookObj[0]], args);
|
||||
if (
|
||||
_self.libraries[hookObj[0]] &&
|
||||
_self.libraries[hookObj[0]][hookObj[1]] &&
|
||||
typeof _self.libraries[hookObj[0]][hookObj[1]] === 'function'
|
||||
) {
|
||||
_self.libraries[hookObj[0]][hookObj[1]].apply(_self.libraries[hookObj[0]], args);
|
||||
} else {
|
||||
if (global.env === 'development') console.log('Info: [plugins] Expected method \'' + hookObj[1] + '\' in plugin \'' + hookObj[0] + '\' not found, skipping.');
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user