From 0286f02dadeb45e78617ed316aa41ea73650d283 Mon Sep 17 00:00:00 2001 From: cha0s Date: Thu, 3 Dec 2020 23:53:21 -0600 Subject: [PATCH] fix: ensafen invokePlugin --- packages/core/src/latus.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/latus.js b/packages/core/src/latus.js index c3ccb21..2acbc28 100644 --- a/packages/core/src/latus.js +++ b/packages/core/src/latus.js @@ -103,9 +103,12 @@ export default class Plugins { if (!this.hooks[hook]) { return undefined; } - return this.hooks[hook] - .find(({plugin: candidate}) => candidate === plugin) - .fn(...(args.concat(this))); + const candidate = this.hooks[hook] + .find(({plugin: candidate}) => candidate === plugin); + if (!candidate) { + return undefined; + } + return candidate.fn(...(args.concat(this))); } invokeReduce(hook, initial = {}, reducer = (r, o) => ({...r, ...o}), ...args) {