Skip to content

Commit df31c00

Browse files
authored
[Bug] Handle formatting empty list (#4086)
1 parent def2a9e commit df31c00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

detection_rules/rule_formatter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def dump_list(self, v):
161161
dump.append(' ' * 4 + self.dump_value(item))
162162
return '[\n{},\n]'.format(',\n'.join(dump))
163163

164-
if all(isinstance(i, dict) for i in v):
164+
if v and all(isinstance(i, dict) for i in v):
165165
# Compact inline format for lists of dictionaries with proper indentation
166166
retval = "\n" + ' ' * 2 + "[\n"
167167
retval += ",\n".join([' ' * 4 + self.dump_inline_table(u).strip() for u in v])

0 commit comments

Comments
 (0)