transform.parent == null not working

I really dont know what is happenning, so, here is the code and the console return:

void OnTriggerStay(Collider other)
{
    if (Input.touchCount == 0 && (transform.parent == null || transform.parent.Equals(null)))
    {
        print(other.name);

        if (other.tag == "CasaLivre")
        {
            print("Entrei");
            transform.parent = other.transform;
            print("O pai inicio"+transform.parent);
            if (transform.name == "cannon(Clone)")
            {
                transform.position = other.transform.position + other.transform.right * 1.3f;
                transform.position = new Vector3(transform.position.x, 1f, transform.position.z);
                other.transform.tag = "CasaOcupadaCan";
            }
            else if (transform.name == "catapult1(Clone)" || transform.name == "catapult2(Clone)")
            {
                transform.position = other.transform.position + other.transform.right * 1.3f - other.transform.forward * 1.3f;
                other.transform.tag = "CasaOcupadaCat";
            }
            else
            {
                transform.position = new Vector3(other.transform.position.x, transform.position.y, other.transform.position.z);
                other.transform.tag = "CasaOcupada";
            }
            GameObject.Find("Tabuleiro").GetComponent<PositioninScript>().posicionados += 1;
            VerificaGiratorio();
        }
        else
        {
            if (transform.parent == null)
            {
                print("Sai");
                transform.position = posInicial;
                transform.parent = null;
            }
        }
        print("O pai fim" + transform.parent);
    }
   
}

alt text

It’s like the null is being ignored.

Please, give me some help.

I think you want transform.parent != null in your else block.