Unity while loop causing freezes on play

I assume this code is being read as an infinite loop, but I cannot figure out why.

I want this code to run until a GameObject is destroyed which would trigger the GameObject enemyTarget to return as null, breaking the loop.

I’ve force quit and rebooted my project about 20 times with new attempts but it’s become clear to me that I’m missing something. Really looking for a second opinion here. This is the code.
StartCoroutine(“Attack”);

public IEnumerator Attack()
    {
        while (enemyTarget != null)
        {
                enemyTarget.GetComponent<EnemyStats>().health -= attackDamage;   //do damage
                yield return new WaitForSeconds(attackSpeed);
        }
        LocateTargets();    //return to searching for targets
        yield return null;
    }

Where do you Destroy the enemyTarget so that it will be ‘null’?
You also might want to move the LocateTargets() to a update method.

Where do you start the coroutine? If you start the coroutine in the update, it will start a while loop every frame, which will definitely cause a crash. @nolan_oc