From c11d60c5f6f2e36f1643f57ed789a74ea4224175 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 1 Feb 2021 00:37:45 -0500 Subject: [PATCH] hooks: Check context nullness, not truthiness --- src/static/js/pluginfw/hooks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static/js/pluginfw/hooks.js b/src/static/js/pluginfw/hooks.js index 75e37315f..14bd9d57e 100644 --- a/src/static/js/pluginfw/hooks.js +++ b/src/static/js/pluginfw/hooks.js @@ -352,7 +352,7 @@ exports.aCallAll = async (hookName, context, cb = null) => { }; exports.callFirst = (hookName, context) => { - if (!context) context = {}; + if (context == null) context = {}; const predicate = (val) => val.length; const hooks = pluginDefs.hooks[hookName] || []; for (const hook of hooks) { @@ -366,7 +366,7 @@ exports.aCallFirst = async (hookName, context, cb = null, predicate = null) => { if (cb != null) { return await attachCallback(exports.aCallFirst(hookName, context, null, predicate), cb); } - if (!context) context = {}; + if (context == null) context = {}; if (predicate == null) predicate = (val) => val.length; const hooks = pluginDefs.hooks[hookName] || []; for (const hook of hooks) {