Update migrate_config.py

Added if statement to prevent looping through header lines if configuration file is empty
This commit is contained in:
Jesse Bona
2019-02-01 19:15:59 +11:00
committed by GitHub
parent 35a78c06d0
commit 7b491c7110

View File

@@ -21,8 +21,10 @@ def _migrate_map(contents):
# Find the first non-header line
lines = contents.splitlines(True)
i = 0
while _is_header_line(lines[i]):
i += 1
# Only loop on non empty configuration file
if i < len(lines):
while _is_header_line(lines[i]):
i += 1
header = ''.join(lines[:i])
rest = ''.join(lines[i:])