try while(player!=null){ do this...)
i think !player and player!=null do not do the same strict way