automod: add safeguard to config preprocessor

This commit is contained in:
Dragory 2020-07-30 11:05:03 +03:00
parent f500034729
commit 18a1b4c31f
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -53,6 +53,11 @@ const configPreprocessor: ConfigPreprocessorFn<AutomodPluginType> = 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