Skip to content

Commit

Permalink
fix: crash on firing action hook that had no listeners registered
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Jan 31, 2021
1 parent 1a04ec6 commit b0f5d5a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions public/src/modules/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b0f5d5a

Please sign in to comment.