Because he uses the entity pointer "player" to check the distance.
If he would not "wait for the player" through using that while loop [which can also be written as while(!player)] you might get an empty pointer error.