Repository: godotengine/godot (language: cpp)

Issue:
`header_guards.py` fails if file is too short
### Tested versions

4.4 1bffd6c73b44b85e5889f54e14b2193940cf5bb1

### System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 31.0.15.4633) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

### Issue description

I created a new file, applied `copyright_headers.py` and tried `header_guards.py`, but it failed with
```
IndexError: list index out of range
Traceback (most recent call last):
  File "C:\godot_source\misc\scripts\header_guards.py", line 74, in <module>
    lines[HEADER_CHECK_OFFSET] == HEADER_CHECK
```
The script expects guards at specific line, but if file is too short, it goes out of bounds.

### Steps to reproduce

1. Create new `.h` file in Godot source directory
2. Run `python misc/scripts/header_guards.py path/to/that/file.h`

### Minimal reproduction project (MRP)

https://github.com/godotengine/godot/archive/refs/heads/master.zip


Discussion / hints:

Fix patch:
diff --git a/misc/scripts/header_guards.py b/misc/scripts/header_guards.py
index fed418db1ed8..4d4150a097b7 100755
--- a/misc/scripts/header_guards.py
+++ b/misc/scripts/header_guards.py
@@ -36,11 +36,16 @@
                 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 = ""


Test patch: