diff --git a/detection_rules/rule_formatter.py b/detection_rules/rule_formatter.py index e7c84611d..e4b4d704b 100644 --- a/detection_rules/rule_formatter.py +++ b/detection_rules/rule_formatter.py @@ -161,7 +161,7 @@ class RuleTomlEncoder(toml.TomlEncoder): dump.append(' ' * 4 + self.dump_value(item)) return '[\n{},\n]'.format(',\n'.join(dump)) - if all(isinstance(i, dict) for i in v): + if v and all(isinstance(i, dict) for i in v): # Compact inline format for lists of dictionaries with proper indentation retval = "\n" + ' ' * 2 + "[\n" retval += ",\n".join([' ' * 4 + self.dump_inline_table(u).strip() for u in v])