Check the order in which a line is read and when the contents of line is checked for null. It looks like the code does it this way:
read a line
check if line is null
read another line (what...