My for loop is crashing unity!

Run into a little problem here, its a simple for loop but for some reason it crashes my unity! I’ve been starring at this for so long now that I can’t see anything wrong with the code.

Weird thing is if i remove everything inside the loop, even the Debug.Log and play, everything works fine?!!?!?!??

    void Start()
    {
        sprRect = grid_Icon.GetComponent<RectTransform>().rect;

        float maxInARow = Mathf.FloorToInt(Screen.width / sprRect.width);
        float maxInACol = Mathf.FloorToInt(Screen.height / sprRect.height);

        gridPerView = maxInARow * maxInACol;

        GenerateGrid();
    }

    void GenerateGrid()
    {
        for (int x = 0; x < screenWidth; x++)
        {
            for (int y = 0; y < screenHeigh; y++)
            {
                Debug.Log("LOL");
            }
        }
    }

Found the solution!

I was using the wring values for the loop.

Fixed the issue by using the calculated amount of tiles per row and col

         for (int x = 0; x < MAXINAROW; x++)
         {
             for (int y = 0; y < MAXINACOL; y++)
             {
                 Debug.Log("LOL");
             }
         }