Fix accessing invalid memory when line is empty