Fix an invalid read found with valgrind.

This probably only occurs on the empty file test.

There are other possible issues with valgrind, but I haven't worked them out yet. I will probably just open another issue to inform you of the problems.