Error in my restart method..

Hi,
this is the restart method:


	public void Restart() {
		object.clear();
		LoadImageLevel(loader.loadImage("/level.png"));
		cam.setX(-32);
	}


and this is the LoadImageLevel method:


	public void LoadImageLevel(BufferedImage image) {
		int w = image.getWidth();
		int h = image.getHeight();

		for (int xx = 0; xx < h; xx++) {
			for (int yy = 0; yy < w; yy++) {
				int pixel = image.getRGB(xx, yy);
				int red = (pixel >> 16) & 0xff;
				int green = (pixel >> 8) & 0xff;
				int blue = (pixel) & 0xff;

				if (red == 0 && green == 0 && blue == 100) {
					addObject(new Background(0, 0, ObjectId.Background)); // background
					addObject(new Block(xx * 32, yy * 32, 0, ObjectId.Block));

				}
				if (red == 100 && green == 60 && blue == 0) { // / block
					addObject(new Block(xx * 32, yy * 32, 0, ObjectId.Block));

				}
				if (red == 100 && green == 50 && blue == 0) { // /block 1
					addObject(new Block(xx * 32, yy * 32, 1, ObjectId.Block));
				}
				if (red == 100 && green == 40 && blue == 0) { // /block 2
					addObject(new Block(xx * 32, yy * 32, 2, ObjectId.Block));
				}
				if (red == 100 && green == 30 && blue == 0) { // /block 3
					addObject(new Block(xx * 32, yy * 32, 3, ObjectId.Block));
				}
				if (red == 255 && green == 255 && blue == 255) { // /block 4
					addObject(new Block(xx * 32, yy * 32, 4, ObjectId.Block));
				}
				if (red == 0 && green == 255 && blue == 33) { // /block up
					addObject(new Block(xx * 32, yy * 32, 5, ObjectId.Block));
				}
				if (red == 0 && green == 245 && blue == 33) { // /block up1
					addObject(new Block(xx * 32, yy * 32, 6, ObjectId.Block));
				}
				if (red == 128 && green == 128 && blue == 128) { // / box
					addObject(new Box(xx * 32, yy * 32, this, ObjectId.Box));

				}
				if (red == 150 && green == 150 && blue == 150) { // /
																	// changedable
																	// block
					addObject(new ChangeableBlock(xx * 32, yy * 32, this,
							ObjectId.ChangeableBlock));

				}
				if (red == 255 && green == 0 && blue == 0) { // /red button
					addObject(new Button(xx * 32, yy * 32, 1, this,
							ObjectId.Button));
				}
				if (red == 0 && green == 0 && blue == 245) { // /blue button
					addObject(new Button(xx * 32, yy * 32, 2, this,
							ObjectId.Button));
				}
				if (red == 255 && green == 30 && blue == 30) { // ///ex
					addObject(new Ex(xx * 32, yy * 32, this, ObjectId.Ex));

				}
				if (red == 0 && green == 0 && blue == 255) { // / player
					addObject(new Player(xx * 32, yy * 32, this,
							ObjectId.Player));

				}

			}
		}
	}

Now,the wired thing is that 50% of the times it works and the other 50% it crashes with this error:


Exception in thread "Thread-2" java.lang.NullPointerException
	at com.shuster.killtheex.objects.Box.tick(Box.java:37)
	at com.shuster.killtheex.window.Handler.tick(Handler.java:36)
	at com.shuster.killtheex.window.Game.tick(Game.java:84)
	at com.shuster.killtheex.window.Game.run(Game.java:66)
	at java.lang.Thread.run(Unknown Source)

And every time it happens with a different object…
Thanks alot!!