my game crashes when on enemy hit

basically when my character collides with an enemy he receives damage but in my case the game crashes, why does it happen?

player script of damage:

public void DamagePlayer(int damagedone)
{
    health -= damagedone;
    OnPlayerDamaged?.Invoke();

    if (health <= 0)
    {
        health = 0;
        OnPlayerDeath?.Invoke();
    }
}

enemy script when damage player:

void Attack()
{
if(!coolDownAttack)
gameObject.GetComponent().DamagePlayer(damagedone);
StartCoroutine(CoolDown());
}

is something wrong ??

Does the editor console return an error ?