Fixed crash when magic line is empty. (#4)

This commit is contained in:
Xaver K 2022-10-26 17:29:32 +02:00 committed by GitHub
parent 66cbe9b2ca
commit ddce20b4ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,7 +180,12 @@ class CKernel(Kernel):
for line in code.splitlines():
if line.startswith('//%'):
key, value = line[3:].split(":", 2)
magicSplit = line[3:].split(":", 2)
if(len(magicSplit) < 2):
self._write_to_stderr("[C kernel] Magic line starting with '//%' is missing a semicolon, ignoring.")
continue
key, value = magicSplit
key = key.strip().lower()
if key in ['ldflags', 'cflags']: