From 9c79307ef972dbd8e188bf58eca43241452288e5 Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 21 Sep 2022 11:33:58 +0200 Subject: [PATCH] hook: check for null object before introspection --- vars/hook.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vars/hook.groovy b/vars/hook.groovy index 0fa6f0d..b5e203a 100644 --- a/vars/hook.groovy +++ b/vars/hook.groovy @@ -6,6 +6,11 @@ def call(String name) { return } def hook = load(filepath) + + if (hook == null) { + error("Hook '${filepath}' seems to be null. Did you forget to add 'return this' at the end of the script ?") + } + if (hook.metaClass.respondsTo(hook, 'exec')) { hook.exec() } else {