Unchecked index causes IndexError.

This commit is contained in:
kubilus1 2016-04-11 01:55:07 -04:00 committed by René Moser
parent 542a96f907
commit 773d402eac

View file

@ -205,6 +205,8 @@ class Crypttab(object):
for line in self._lines:
lines.append(str(line))
crypttab = '\n'.join(lines)
if len(crypttab) == 0:
crypttab += '\n'
if crypttab[-1] != '\n':
crypttab += '\n'
return crypttab