Fix IndexError for when stdout and stderr of formatter are empty.

This commit is contained in:
Chiel ten Brinke 2016-02-15 09:50:41 +01:00
parent bf57abea05
commit b939719fe6

View File

@ -181,7 +181,7 @@ else:
# However, extra newlines are almost never required, while there are linters that complain
# about superfluous newlines, so we remove one empty newline at the end of the file.
for eol in possible_eols:
if stdoutdata[-1] == eol:
if len(stdoutdata) > 0 and stdoutdata[-1] == eol:
stdoutdata = stdoutdata[:-1]
lines = [stdoutdata]
@ -231,7 +231,7 @@ else:
# However, extra newlines are almost never required, while there are linters that complain
# about superfluous newlines, so we remove one empty newline at the end of the file.
for eol in possible_eols:
if stdoutdata[-1] == eol:
if len(stdoutdata) > 0 and stdoutdata[-1] == eol:
stdoutdata = stdoutdata[:-1]
lines = [stdoutdata]