Only attempt lines trim if the list isn't empty

This commit is contained in:
Peter McConnell 2020-04-27 20:26:00 +01:00
parent 05231ffae0
commit 74fa987b9e
1 changed files with 2 additions and 1 deletions

View File

@ -106,7 +106,8 @@ def update_hosts_file():
break;
#remove all the trailing newlines on the line list
while lines[-1].strip()=="": lines.pop()
if lines:
while lines[-1].strip()=="": lines.pop()
#append all the domain lines
if len(hosts)>0: