Fix a buffer underflow

This was happening while attempting to strip trailing spaces from
empty lines, and was found using valgrind.