Inserted null check for player.