style.py: don't die on empty files
authorSteve Reinhardt <steve.reinhardt@amd.com>
Sat, 24 Sep 2011 15:12:26 +0000 (08:12 -0700)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Sat, 24 Sep 2011 15:12:26 +0000 (08:12 -0700)
util/style.py

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