style.py: don't die on empty files

This commit is contained in:
Steve Reinhardt 2011-09-24 08:12:26 -07:00
parent 40b6c9cb2e
commit ed61e02b24

View file

@ -233,6 +233,9 @@ class SortedIncludes(Verifier):
old = ''.join(line + '\n' for line in lines) old = ''.join(line + '\n' for line in lines)
f.close() f.close()
if len(lines) == 0:
return 0
language = lang_type(filename, lines[0]) language = lang_type(filename, lines[0])
sort_lines = list(self.sort_includes(lines, filename, language)) sort_lines = list(self.sort_includes(lines, filename, language))
new = ''.join(line + '\n' for line in sort_lines) new = ''.join(line + '\n' for line in sort_lines)