From 7558bed89377bc7f9c9284a5bce5cf798e91b7ed Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 8 Dec 2024 01:57:49 -0500 Subject: [PATCH] fixed crash when file too short --- misc/scripts/header_guards.py | 5 +++++ 1 file changed, 5 insertions(+) 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 = ""