Add check to make sure the program does not try to read beyond the end
of the line.