I have started to make a sweeper-ish game, and so far i've only tried to draw the base grid, with empty squares mixed with bombed squares

It compiles just fine, but it crashes when i start it for some strange reason, and i can't seem to find why...
Here is my code:

Code:
#include <ClanLib/core.h>
#include <ClanLib/application.h>
#include <ClanLib/display.h>
#define __Apple__
#ifdef USE_SDL
#include <ClanLib/sdl.h>
#else
#include <ClanLib/gl.h>
#endif

int grid[20][20];

class Sweeper : public CL_ClanApplication
{
public:
	virtual int main(int argc, char **argv)
	{
		CL_ConsoleWindow console("Console");
		console.redirect_stdio();
		quit = false;

			srand((GLint)CL_System::get_time());
			
			for (int i = 0; i < 20;i++)
			{
				for (int j = 0; j < 20;j++)
				{
					if ((int)rand()%5 == 1)
					{
						grid[j][i] = 1;
					}
					else
					{
						grid[j][i] = 0;
					}
				}
			}

		try
		{
			CL_SetupCore setup_core;
			CL_SetupDisplay setup_display;

#ifdef USE_SDL
			CL_SetupSDL setup_sdl;
#else
			CL_SetupGL setup_gl;
#endif
			CL_DisplayWindow window("Sweeper", 300, 300);
			CL_Slot slot_quit = window.sig_window_close().connect(this, &Sweeper::on_window_close);

			// Connect a keyboard handler to on_key_up()
			CL_Slot slot_input_up = (window.get_ic()->get_keyboard()).sig_key_up().connect(this, &Sweeper::on_input_up);

			CL_Surface bild_bomb("bomb.tga");
			CL_Surface bild_empty("tom.tga");
				
			while (!quit)
			{
				CL_Display::clear(CL_Color(0,0,56));

				//Draw:
				for (int i = 0; i < 20;i++)
				{
					for (int j = 0; i < 20;j++)
					{
						if (grid[j][i] == 1)
						{
							bild_bomb.draw (15*j,15*i, window.get_gc());
						}
						else
						{
							bild_empty.draw (15*j, 15*i, window.get_gc());
						}
					}
				}
		
				CL_Display::flip();
				CL_System::keep_alive(10);
			}
		}
		catch(CL_Error error)
		{
			std::cout << "Exception caught : " << error.message.c_str() << std::endl;			

			// Display console close message and wait for a key
			console.display_close_message();
			return -1;
		}
		return 0;
	}

private:
	bool quit;

	void on_input_up(const CL_InputEvent &key)
	{
		if(key.id == CL_KEY_ESCAPE)
		{
			quit = true;
		}
	}

	void on_window_close()
	{
		quit = true;
	}
} my_app;
I am using visual studio 2005 and CL 0,8

I have located that the problem is with the double for statments which attempts to draw, if i comment this part out it works just fine.

Anyone who got any suggestions?