splitSources.py: Support the case where the input file is empty

This commit is contained in:
Kamil Śliwak 2021-09-17 20:08:49 +02:00
parent a67828b9ba
commit 970381cb1d

View File

@ -65,7 +65,7 @@ if __name__ == '__main__':
# decide if file has multiple sources
with open(filePath, mode='r', encoding='utf8', newline='') as f:
lines = f.read().splitlines()
if lines[0][:12] == "==== Source:":
if len(lines) >= 1 and lines[0][:12] == "==== Source:":
hasMultipleSources = True
writeSourceToFile(lines)