mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: crash on firing action hook that had no listeners registered
This commit is contained in:
@@ -36,6 +36,10 @@ define('hooks', [], () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const _fireActionHook = (hookName, data) => {
|
const _fireActionHook = (hookName, data) => {
|
||||||
|
if (!Hooks.hasListeners(hookName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Hooks.loaded[hookName].forEach(listener => listener(data));
|
Hooks.loaded[hookName].forEach(listener => listener(data));
|
||||||
|
|
||||||
// Backwards compatibility (remove this when we eventually remove jQuery from NodeBB core)
|
// Backwards compatibility (remove this when we eventually remove jQuery from NodeBB core)
|
||||||
|
|||||||
Reference in New Issue
Block a user