fix: crash on firing action hook that had no listeners registered

This commit is contained in:
Julian Lam
2021-01-31 16:58:27 -05:00
parent 1a04ec6419
commit b0f5d5a594

View File

@@ -36,6 +36,10 @@ define('hooks', [], () => {
};
const _fireActionHook = (hookName, data) => {
if (!Hooks.hasListeners(hookName)) {
return;
}
Hooks.loaded[hookName].forEach(listener => listener(data));
// Backwards compatibility (remove this when we eventually remove jQuery from NodeBB core)