Fix crash

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-08-24 19:12:32 +02:00
parent 08abddc7fc
commit 5e7bc37fb5

View File

@@ -125,7 +125,9 @@ def check_raw(path, max_length):
ok = True
with open(path, 'r') as f:
text = f.read()
if text[-1] == os.linesep:
if not text:
ok = error(path, "empty")
elif text[-1] == os.linesep:
text = text[:-1]
else:
ok = error(path, "missing new line")