Browse Source

fixed crash when file too short

Andrew 9 months ago
parent
commit
7558bed893
1 changed files with 5 additions and 0 deletions
  1. 5 0
      misc/scripts/header_guards.py

+ 5 - 0
misc/scripts/header_guards.py

@@ -36,11 +36,16 @@ for file in sys.argv[1:]:
                 break
 
     if HEADER_CHECK_OFFSET < 0:
+        invalid.append(file)
         continue
 
     HEADER_BEGIN_OFFSET = HEADER_CHECK_OFFSET + 1
     HEADER_END_OFFSET = len(lines) - 1
 
+    if HEADER_BEGIN_OFFSET >= HEADER_END_OFFSET:
+        invalid.append(file)
+        continue
+
     split = file.split("/")  # Already in posix-format.
 
     prefix = ""