title: stackoverflow exception in simple mine sweeper game
body: <p>I am calling a recursive function (left click on the square) and I can’t find where the problem is.</p>
  
  <p>It is supposed to change the background image to the correct number, set it to "pressed" and if it the number of mines near the square is 0, it will leftclick all the squares near it.</p>
  
  <p>"board" is 2d array of squares(Mine class)</p>
  
  <pre><code>private void leftClick(int x, int y)
  {
      if (!board[x][y].pressed)
      {
          if (board[x][y].bomb == true)
          {
              board[x][y].BackgroundImage = Properties.Resources.bomb;
              if (MessageBox.Show("You lost! new game?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
              {
                  Form.ActiveForm.Hide();
                  Form form2 = new MineSweeper.mainForm();
                  form2.ShowDialog();
              }
              else
                  Application.Exit();
          }
          else
          {
              switch (board[x][y].numOfMines)
              {
                  case 0:
                      board[x][y].BackgroundImage = Properties.Resources._0;
                      if (x - 1 &gt;= 0 &amp;&amp; y - 1 &gt;= 0 &amp;&amp; x - 1 &lt; row &amp;&amp; y - 1 &lt; column &amp;&amp; board[x-1][y-1].pressed==false)
                          leftClick(x - 1, y - 1);
                      if (x &gt;= 0 &amp;&amp; y - 1 &gt;= 0 &amp;&amp; x &lt; row &amp;&amp; y - 1 &lt; column &amp;&amp; board[x][y - 1].pressed == false)
                          leftClick(x, y - 1);
                      if (x + 1 &gt;= 0 &amp;&amp; y - 1 &gt;= 0 &amp;&amp; x + 1 &lt; row &amp;&amp; y - 1 &lt; column &amp;&amp; board[x + 1][y - 1].pressed == false)
                          leftClick(x + 1, y - 1);
                      if (x - 1 &gt;= 0 &amp;&amp; y &gt;= 0 &amp;&amp; x - 1 &lt; row &amp;&amp; y &lt; column &amp;&amp; board[x - 1][y].pressed == false)
                          leftClick(x - 1, y);
                      if (x + 1 &gt;= 0 &amp;&amp; y &gt;= 0 &amp;&amp; x + 1 &lt; row &amp;&amp; y &lt; column &amp;&amp; board[x + 1][y].pressed == false)
                          leftClick(x + 1, y);
                      if (x - 1 &gt;= 0 &amp;&amp; y + 1 &gt;= 0 &amp;&amp; x - 1 &lt; row &amp;&amp; y + 1 &lt; column &amp;&amp; board[x - 1][y + 1].pressed == false)
                          leftClick(x - 1, y + 1);
                      if (x &gt;= 0 &amp;&amp; y + 1 &gt;= 0 &amp;&amp; x &lt; row &amp;&amp; y + 1 &lt; column &amp;&amp; board[x ][y + 1].pressed == false)
                          leftClick(x, y + 1);
                      if (x + 1 &gt;= 0 &amp;&amp; y + 1 &gt;= 0 &amp;&amp; x + 1 &lt; row &amp;&amp; y + 1 &lt; column &amp;&amp; board[x + 1][y + 1].pressed == false)
                          leftClick(x + 1, y + 1);
                      break;
                  case 1:
                      board[x][y].BackgroundImage = Properties.Resources._1;
                      break;
                  case 2:
                      board[x][y].BackgroundImage = Properties.Resources._2;
                      break;
                  case 3:
                      board[x][y].BackgroundImage = Properties.Resources._3;
                      break;
                  case 4:
                      board[x][y].BackgroundImage = Properties.Resources._4;
                      break;
                  case 5:
                      board[x][y].BackgroundImage = Properties.Resources._5;
                      break;
                  case 6:
                      board[x][y].BackgroundImage = Properties.Resources._6;
                      break;
                  case 7:
                      board[x][y].BackgroundImage = Properties.Resources._7;
                      break;
                  case 8:
                      board[x][y].BackgroundImage = Properties.Resources._8;
                      break;
              }
          }
          board[x][y].pressed = true;
      }         
  }
  </code></pre>