Unity freezes when adding a GameObject to a List

Since 3 days ago Unity started freezing after adding a GameObject to a List. I haven’t changed anything in that particular code, so I have no idea why this is happening:

 private IEnumerator HandleSelectedCubes() {
    if (InputManager.instance.selectedCube != null && !selectedCubes.Contains(InputManager.instance.selectedCube)) {
        if (oldSelectedCube == null) {
            selectedCubes.Add(InputManager.instance.selectedCube); // This is where it crashes
            oldSelectedCube = InputManager.instance.selectedCube;
        } else if (InputManager.instance.selectedCube.name != oldSelectedCube.name) {
            ClearSelectedCubes();
            selectedCubes.Add(InputManager.instance.selectedCube);
            oldSelectedCube = InputManager.instance.selectedCube;
            InputManager.instance.selectedCube = null;
        }

        AudioManager.instance.PlayCubeSelectSound();

        if (selectedCubes.Count == 4) {
            InputManager.instance.allowCubeSelection = false;
            moveDone = true;
            yield return new WaitForSeconds(0.07f);

            var destroySelectedCubes = true;

            foreach (var cube in selectedCubes.ToList()) {
                if (cube != null && cube.tag == "Lightning")
                    destroySelectedCubes = false;
            }

            foreach (var cube in selectedCubes.ToList()) {
                if (cube != null) {
                    cube.GetComponent<Cube>().hasGivenShard = true;
                    CubeAbilities.instance.TriggerSpecialCubeAbility(cube);

                    if (destroySelectedCubes) {
                        DestroyCube(cube);
                        ClearSelectedCubes();
                    }
                }
            }

            InputManager.instance.playerMovesCount++;
            AudioManager.instance.PlayCubeDisappearSound();
            ShardManager.instance.AddSessionShards(4);
        }
    }
}

InputManager:

  private void RegisterTouchInputs() {
        if (!IsScreenTouched() || !allowCubeSelection) return;

        var touch = Input.GetTouch(0);

        worldTouchPoint = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
        var radius = 0.1f;
        var allHits = Physics2D.CircleCastAll(worldTouchPoint, radius, Vector2.zero);

        // Find closest collider that was touched
        var closestDist = Mathf.Infinity;
        GameObject closestObject = null;

        foreach (var hit in allHits) {
            // Record the object if it's the first one we check, or is closer to the touch point than the previous
            if ((closestObject == null || Vector2.Distance(closestObject.transform.position, worldTouchPoint) < closestDist) && hit.collider.transform.parent.tag != "Indestructible") {
                closestObject = hit.collider.gameObject;
                closestDist = Vector2.Distance(closestObject.transform.position, worldTouchPoint);
            } else {
                return;
            }

            //If there isn't an old cube or if the touch phase has just started, select the cube
            //Or if the touch phase has started and is moving (the user is holding and selecting cubes) and previously selected cubes are the same as this one, select the cube
            if ((CubeBehavior.instance.oldSelectedCube == null || touch.phase == TouchPhase.Began ||
                (touch.phase == TouchPhase.Moved && CubeBehavior.instance.oldSelectedCube != null && CubeBehavior.instance.oldSelectedCube.name == closestObject.name))) {
                CubeBehavior.instance.selectedCube = closestObject;
            } //If the touch phase has started and is moving (the user is holding and selecting cubes) but previously selected cubes are the same as this one, ignore the cube
            // This is so that it doesn't break the chain if the user goes over a differently colored cube
            else if (touch.phase == TouchPhase.Moved && CubeBehavior.instance.oldSelectedCube != null && CubeBehavior.instance.oldSelectedCube.name != closestObject.name) {
                return;
            }
        }
    }

@username
What is selectedCube in your code ?? Are you sure inputmanager instance founded when you add selectedCube in list ??