From 18a1b4c31fe66114f5f8f7ca228ac86d37429cc5 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Thu, 30 Jul 2020 11:05:03 +0300 Subject: [PATCH] automod: add safeguard to config preprocessor --- backend/src/plugins/Automod/AutomodPlugin.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/src/plugins/Automod/AutomodPlugin.ts b/backend/src/plugins/Automod/AutomodPlugin.ts index d37ae24c..5b6af650 100644 --- a/backend/src/plugins/Automod/AutomodPlugin.ts +++ b/backend/src/plugins/Automod/AutomodPlugin.ts @@ -53,6 +53,11 @@ const configPreprocessor: ConfigPreprocessorFn = options => { if (options.config?.rules) { // Loop through each rule for (const [name, rule] of Object.entries(options.config.rules)) { + if (rule == null) { + delete options.config.rules[name]; + continue; + } + rule["name"] = name; // If the rule doesn't have an explicitly set "enabled" property, set it to true